diff --git a/.schema/openapi/templates/go/.travis.yml b/.schema/openapi/templates/go/.travis.yml deleted file mode 100644 index f5cb2ce9a5aa..000000000000 --- a/.schema/openapi/templates/go/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: go - -install: - - go get -d -v . - -script: - - go build -v ./ - diff --git a/.schema/openapi/templates/go/README.mustache b/.schema/openapi/templates/go/README.mustache deleted file mode 100644 index b75fa1bb47bc..000000000000 --- a/.schema/openapi/templates/go/README.mustache +++ /dev/null @@ -1,221 +0,0 @@ -# Go API client for {{packageName}} - -{{#appDescriptionWithNewLines}} -{{{appDescriptionWithNewLines}}} -{{/appDescriptionWithNewLines}} - -## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. - -- API version: {{appVersion}} -- Package version: {{packageVersion}} -{{^hideGenerationTimestamp}} -- Build date: {{generatedDate}} -{{/hideGenerationTimestamp}} -- Build package: {{generatorClass}} -{{#infoUrl}} -For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) -{{/infoUrl}} - -## Installation - -Install the following dependencies: - -```shell -go get github.com/stretchr/testify/assert -go get golang.org/x/oauth2 -go get golang.org/x/net/context -``` - -Put the package under your project folder and add the following in import: - -```golang -import {{packageName}} "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}{{/isGoSubmodule}}" -``` - -To use a proxy, set the environment variable `HTTP_PROXY`: - -```golang -os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") -``` - -## Configuration of Server URL - -Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. - -### Select Server Configuration - -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. - -```golang -ctx := context.WithValue(context.Background(), {{packageName}}.ContextServerIndex, 1) -``` - -### Templated Server URL - -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. - -```golang -ctx := context.WithValue(context.Background(), {{packageName}}.ContextServerVariables, map[string]string{ - "basePath": "v2", -}) -``` - -Note, enum values are always validated and all unused variables are silently ignored. - -### URLs Configuration per Operation - -Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. -An operation is uniquely identifield by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. - -``` -ctx := context.WithValue(context.Background(), {{packageName}}.ContextOperationServerIndices, map[string]int{ - "{classname}Service.{nickname}": 2, -}) -ctx = context.WithValue(context.Background(), {{packageName}}.ContextOperationServerVariables, map[string]map[string]string{ - "{classname}Service.{nickname}": { - "port": "8443", - }, -}) -``` - -## Documentation for API Endpoints - -All URIs are relative to *{{basePath}}* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} -{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} - -## Documentation For Models - -{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) -{{/model}}{{/models}} - -## Documentation For Authorization - -{{^authMethods}} Endpoints do not require authorization. -{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} -{{#authMethods}} - -### {{{name}}} - -{{#isApiKey}} -- **Type**: API key -- **API key parameter name**: {{{keyParamName}}} -- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - -Note, each API key must be added to a map of `map[string]APIKey` where the key is: {{keyParamName}} and passed in as the auth context for each request. - -{{/isApiKey}} -{{#isBasic}} -{{#isBasicBearer}} -- **Type**: HTTP Bearer token authentication - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING") -r, err := client.Service.Operation(auth, args) -``` - -{{/isBasicBearer}} -{{#isBasicBasic}} -- **Type**: HTTP basic authentication - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ - UserName: "username", - Password: "password", -}) -r, err := client.Service.Operation(auth, args) -``` - -{{/isBasicBasic}} -{{#isHttpSignature}} -- **Type**: HTTP signature authentication - -Example - -```golang - authConfig := client.HttpSignatureAuth{ - KeyId: "my-key-id", - PrivateKeyPath: "rsa.pem", - Passphrase: "my-passphrase", - SigningScheme: sw.HttpSigningSchemeHs2019, - SignedHeaders: []string{ - sw.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target. - sw.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value. - "Host", // The Host request header specifies the domain name of the server, and optionally the TCP port number. - "Date", // The date and time at which the message was originated. - "Content-Type", // The Media type of the body of the request. - "Digest", // A cryptographic digest of the request body. - }, - SigningAlgorithm: sw.HttpSigningAlgorithmRsaPSS, - SignatureMaxValidity: 5 * time.Minute, - } - var authCtx context.Context - var err error - if authCtx, err = authConfig.ContextWithValue(context.Background()); err != nil { - // Process error - } - r, err = client.Service.Operation(auth, args) - -``` -{{/isHttpSignature}} -{{/isBasic}} -{{#isOAuth}} - -- **Type**: OAuth -- **Flow**: {{{flow}}} -- **Authorization URL**: {{{authorizationUrl}}} -- **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - **{{{scope}}}**: {{{description}}} -{{/scopes}} - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") -r, err := client.Service.Operation(auth, args) -``` - -Or via OAuth2 module to automatically refresh tokens and perform user authentication. - -```golang -import "golang.org/x/oauth2" - -/* Perform OAuth2 round trip request and obtain a token */ - -tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) -auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) -r, err := client.Service.Operation(auth, args) -``` - -{{/isOAuth}} -{{/authMethods}} - -## Documentation for Utility Methods - -Due to the fact that model structure members are all pointers, this package contains -a number of utility functions to easily obtain pointers to values of basic types. -Each of these functions takes a value of the given basic type and returns a pointer to it: - -* `PtrBool` -* `PtrInt` -* `PtrInt32` -* `PtrInt64` -* `PtrFloat` -* `PtrFloat32` -* `PtrFloat64` -* `PtrString` -* `PtrTime` - -## Author - -{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} -{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/.schema/openapi/templates/go/api.mustache b/.schema/openapi/templates/go/api.mustache deleted file mode 100644 index 6ee735a7ffdd..000000000000 --- a/.schema/openapi/templates/go/api.mustache +++ /dev/null @@ -1,377 +0,0 @@ -{{>partial_header}} -package {{packageName}} - -{{#operations}} -import ( - "bytes" - "context" - "io" - "net/http" - "net/url" -{{#imports}} "{{import}}" -{{/imports}} -) - -// Linger please -var ( - _ context.Context -) -{{#generateInterfaces}} - -type {{classname}} interface { - {{#operation}} - - /* - * {{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} - {{#notes}} - * {{{unescapedNotes}}} - {{/notes}} - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().{{#pathParams}} - * @param {{paramName}}{{#description}} {{{.}}}{{/description}}{{/pathParams}} - * @return {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request - */ - {{{nickname}}}(ctx context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request - - /* - * {{nickname}}Execute executes the request{{#returnType}} - * @return {{{.}}}{{/returnType}} - */ - {{nickname}}Execute(r {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request) ({{#returnType}}{{^isArray}}{{^returnTypeIsPrimitive}}*{{/returnTypeIsPrimitive}}{{/isArray}}{{{.}}}, {{/returnType}}*http.Response, error) - {{/operation}} -} -{{/generateInterfaces}} - -// {{classname}}Service {{classname}} service -type {{classname}}Service service -{{#operation}} - -type {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request struct { - ctx context.Context{{#generateInterfaces}} - ApiService {{classname}} -{{/generateInterfaces}}{{^generateInterfaces}} - ApiService *{{classname}}Service -{{/generateInterfaces}} -{{#allParams}} - {{paramName}} {{^isPathParam}}*{{/isPathParam}}{{{dataType}}} -{{/allParams}} -} -{{#allParams}}{{^isPathParam}} -func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{paramName}} {{{dataType}}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request { - r.{{paramName}} = &{{paramName}} - return r -}{{/isPathParam}}{{/allParams}} - -func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request) Execute() ({{#returnType}}{{^isArray}}{{^returnTypeIsPrimitive}}*{{/returnTypeIsPrimitive}}{{/isArray}}{{{.}}}, {{/returnType}}*http.Response, error) { - return r.ApiService.{{nickname}}Execute(r) -} - -/* - * {{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} -{{#notes}} - * {{{unescapedNotes}}} -{{/notes}} - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().{{#pathParams}} - * @param {{paramName}}{{#description}} {{{.}}}{{/description}}{{/pathParams}} - * @return {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request - */ -func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request { - return {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request{ - ApiService: a, - ctx: ctx,{{#pathParams}} - {{paramName}}: {{paramName}},{{/pathParams}} - } -} - -/* - * Execute executes the request{{#returnType}} - * @return {{{.}}}{{/returnType}} - */ -func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request) ({{#returnType}}{{^isArray}}{{^returnTypeIsPrimitive}}*{{/returnTypeIsPrimitive}}{{/isArray}}{{{.}}}, {{/returnType}}*http.Response, error) { - var ( - localVarHTTPMethod = http.Method{{httpMethod}} - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - {{#returnType}} - localVarReturnValue {{^isArray}}{{^returnTypeIsPrimitive}}*{{/returnTypeIsPrimitive}}{{/isArray}}{{{.}}} - {{/returnType}} - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "{{{classname}}}Service.{{{nickname}}}") - if err != nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "{{{path}}}"{{#pathParams}} - localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", url.PathEscape(parameterToString(r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")), -1){{/pathParams}} - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - {{#allParams}} - {{#required}} - {{^isPathParam}} - if r.{{paramName}} == nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} is required and must be specified") - } - {{/isPathParam}} - {{#minItems}} - if len({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) < {{minItems}} { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minItems}} elements") - } - {{/minItems}} - {{#maxItems}} - if len({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) > {{maxItems}} { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxItems}} elements") - } - {{/maxItems}} - {{#minLength}} - if strlen({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) < {{minLength}} { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minLength}} elements") - } - {{/minLength}} - {{#maxLength}} - if strlen({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) > {{maxLength}} { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxLength}} elements") - } - {{/maxLength}} - {{#minimum}} - {{#isString}} - {{paramName}}Txt, err := atoi({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) - if {{paramName}}Txt < {{minimum}} { - {{/isString}} - {{^isString}} - if {{^isPathParam}}*{{/isPathParam}}r.{{paramName}} < {{minimum}} { - {{/isString}} - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be greater than {{minimum}}") - } - {{/minimum}} - {{#maximum}} - {{#isString}} - {{paramName}}Txt, err := atoi({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) - if {{paramName}}Txt > {{maximum}} { - {{/isString}} - {{^isString}} - if {{^isPathParam}}*{{/isPathParam}}r.{{paramName}} > {{maximum}} { - {{/isString}} - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be less than {{maximum}}") - } - {{/maximum}} - {{/required}} - {{/allParams}} - - {{#queryParams}} - {{#required}} - {{#isCollectionFormatMulti}} - { - t := *r.{{paramName}} - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("{{baseName}}", parameterToString(s.Index(i), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) - } - } else { - localVarQueryParams.Add("{{baseName}}", parameterToString(t, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) - } - } - {{/isCollectionFormatMulti}} - {{^isCollectionFormatMulti}} - localVarQueryParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) - {{/isCollectionFormatMulti}} - {{/required}} - {{^required}} - if r.{{paramName}} != nil { - {{#isCollectionFormatMulti}} - t := *r.{{paramName}} - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("{{baseName}}", parameterToString(s.Index(i), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) - } - } else { - localVarQueryParams.Add("{{baseName}}", parameterToString(t, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) - } - {{/isCollectionFormatMulti}} - {{^isCollectionFormatMulti}} - localVarQueryParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) - {{/isCollectionFormatMulti}} - } - {{/required}} - {{/queryParams}} - // to determine the Content-Type header -{{=<% %>=}} - localVarHTTPContentTypes := []string{<%#consumes%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/consumes%>} -<%={{ }}=%> - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header -{{=<% %>=}} - localVarHTTPHeaderAccepts := []string{<%#produces%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/produces%>} -<%={{ }}=%> - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } -{{#headerParams}} - {{#required}} - localVarHeaderParams["{{baseName}}"] = parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") - {{/required}} - {{^required}} - if r.{{paramName}} != nil { - localVarHeaderParams["{{baseName}}"] = parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") - } - {{/required}} -{{/headerParams}} -{{#formParams}} -{{#isFile}} - localVarFormFileName = "{{baseName}}" -{{#required}} - localVarFile := *r.{{paramName}} -{{/required}} -{{^required}} - var localVarFile {{dataType}} - if r.{{paramName}} != nil { - localVarFile = *r.{{paramName}} - } -{{/required}} - if localVarFile != nil { - fbs, _ := io.ReadAll(localVarFile) - localVarFileBytes = fbs - localVarFileName = localVarFile.Name() - localVarFile.Close() - } -{{/isFile}} -{{^isFile}} -{{#required}} - localVarFormParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) -{{/required}} -{{^required}} -{{#isModel}} - if r.{{paramName}} != nil { - paramJson, err := parameterToJson(*r.{{paramName}}) - if err != nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err - } - localVarFormParams.Add("{{baseName}}", paramJson) - } -{{/isModel}} -{{^isModel}} - if r.{{paramName}} != nil { - localVarFormParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) - } -{{/isModel}} -{{/required}} -{{/isFile}} -{{/formParams}} -{{#bodyParams}} - // body params - localVarPostBody = r.{{paramName}} -{{/bodyParams}} -{{#authMethods}} -{{#isApiKey}} -{{^isKeyInCookie}} - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - {{#vendorExtensions.x-auth-id-alias}} - if apiKey, ok := auth["{{.}}"]; ok { - var key string - if prefix, ok := auth["{{name}}"]; ok && prefix.Prefix != "" { - key = prefix.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - {{/vendorExtensions.x-auth-id-alias}} - {{^vendorExtensions.x-auth-id-alias}} - if apiKey, ok := auth["{{name}}"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - {{/vendorExtensions.x-auth-id-alias}} - {{#isKeyInHeader}} - localVarHeaderParams["{{keyParamName}}"] = key - {{/isKeyInHeader}} - {{#isKeyInQuery}} - localVarQueryParams.Add("{{keyParamName}}", key) - {{/isKeyInQuery}} - } - } - } -{{/isKeyInCookie}} -{{/isApiKey}} -{{/authMethods}} - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) - if err != nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - {{#responses}} - {{#dataType}} - {{^is1xx}} - {{^is2xx}} - {{^wildcard}} - if localVarHTTPResponse.StatusCode == {{{code}}} { - {{/wildcard}} - var v {{{dataType}}} - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, newErr - } - newErr.model = v - {{^-last}} - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, newErr - {{/-last}} - {{^wildcard}} - } - {{/wildcard}} - {{/is2xx}} - {{/is1xx}} - {{/dataType}} - {{/responses}} - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, newErr - } - - {{#returnType}} - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, newErr - } - - {{/returnType}} - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, nil -} -{{/operation}} -{{/operations}} diff --git a/.schema/openapi/templates/go/api_doc.mustache b/.schema/openapi/templates/go/api_doc.mustache deleted file mode 100644 index 3e7c11b475ad..000000000000 --- a/.schema/openapi/templates/go/api_doc.mustache +++ /dev/null @@ -1,92 +0,0 @@ -# {{invokerPackage}}\{{classname}}{{#description}} - -{{description}}{{/description}} - -All URIs are relative to *{{basePath}}* - -Method | HTTP request | Description -------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} -{{/operation}}{{/operations}} - -{{#operations}} -{{#operation}} - -## {{{operationId}}} - -> {{#returnType}}{{{.}}} {{/returnType}}{{{operationId}}}(ctx{{#pathParams}}, {{paramName}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{vendorExtensions.x-export-param-name}}({{paramName}}){{/isPathParam}}{{/allParams}}.Execute() - -{{{summary}}}{{#notes}} - -{{{unespacedNotes}}}{{/notes}} - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" -{{#vendorExtensions.x-go-import}} -{{{vendorExtensions.x-go-import}}} -{{/vendorExtensions.x-go-import}} - {{goImportAlias}} "./openapi" -) - -func main() { - {{#allParams}} - {{paramName}} := {{{vendorExtensions.x-go-example}}} // {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} - {{/allParams}} - - configuration := {{goImportAlias}}.NewConfiguration() - apiClient := {{goImportAlias}}.NewAPIClient(configuration) - resp, r, err := apiClient.{{classname}}.{{operationId}}(context.Background(){{#pathParams}}, {{paramName}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{vendorExtensions.x-export-param-name}}({{paramName}}){{/isPathParam}}{{/allParams}}.Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `{{classname}}.{{operationId}}``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - {{#returnType}} - // response from `{{operationId}}`: {{{.}}} - fmt.Fprintf(os.Stdout, "Response from `{{classname}}.{{operationId}}`: %v\n", resp) - {{/returnType}} -} -``` - -### Path Parameters - -{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#pathParams}}{{#-last}} -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.{{/-last}}{{/pathParams}}{{#pathParams}} -**{{paramName}}** | {{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/pathParams}} - -### Other Parameters - -Other parameters are passed through a pointer to a api{{{nickname}}}Request struct via the builder pattern -{{#allParams}}{{#-last}} - -Name | Type | Description | Notes -------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}} -{{^isPathParam}} **{{paramName}}** | {{#isContainer}}{{#isArray}}{{#items}}{{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**[]{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}{{/items}}{{/isArray}}{{#isMap}}{{#items}}{{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**map[string]{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}{{/items}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}{{/isContainer}} | {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/isPathParam}}{{/allParams}} - -### Return type - -{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}} (empty response body){{/returnType}} - -### Authorization - -{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} - -### HTTP request headers - -- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} -- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -{{/operation}} -{{/operations}} diff --git a/.schema/openapi/templates/go/client.mustache b/.schema/openapi/templates/go/client.mustache deleted file mode 100644 index 73fa05566715..000000000000 --- a/.schema/openapi/templates/go/client.mustache +++ /dev/null @@ -1,583 +0,0 @@ -{{>partial_header}} -package {{packageName}} - -import ( - "bytes" - "context" - "encoding/json" - "encoding/xml" - "errors" - "fmt" - "io" - "log" - "mime/multipart" - "net/http" - "net/http/httputil" - "net/url" - "os" - "path/filepath" - "reflect" - "regexp" - "strconv" - "strings" - "time" - "unicode/utf8" - - "golang.org/x/oauth2" - {{#withAWSV4Signature}} - awsv4 "github.com/aws/aws-sdk-go/aws/signer/v4" - awscredentials "github.com/aws/aws-sdk-go/aws/credentials" - {{/withAWSV4Signature}} -) - -var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) - xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) -) - -// APIClient manages communication with the {{appName}} API v{{version}} -// In most cases there should be only one, shared, APIClient. -type APIClient struct { - cfg *Configuration - common service // Reuse a single struct instead of allocating one for each service on the heap. - - // API Services -{{#apiInfo}} -{{#apis}} -{{#operations}} - - {{#generateInterfaces}} - {{classname}} {{classname}} - {{/generateInterfaces}} - {{^generateInterfaces}} - {{classname}} *{{classname}}Service - {{/generateInterfaces}} -{{/operations}} -{{/apis}} -{{/apiInfo}} -} - -type service struct { - client *APIClient -} - -// NewAPIClient creates a new API client. Requires a userAgent string describing your application. -// optionally a custom http.Client to allow for advanced features such as caching. -func NewAPIClient(cfg *Configuration) *APIClient { - if cfg.HTTPClient == nil { - cfg.HTTPClient = http.DefaultClient - } - - c := &APIClient{} - c.cfg = cfg - c.common.client = c - -{{#apiInfo}} - // API Services -{{#apis}} -{{#operations}} - c.{{classname}} = (*{{classname}}Service)(&c.common) -{{/operations}} -{{/apis}} -{{/apiInfo}} - - return c -} - -func atoi(in string) (int, error) { - return strconv.Atoi(in) -} - -// selectHeaderContentType select a content type from the available list. -func selectHeaderContentType(contentTypes []string) string { - if len(contentTypes) == 0 { - return "" - } - if contains(contentTypes, "application/json") { - return "application/json" - } - return contentTypes[0] // use the first content type specified in 'consumes' -} - -// selectHeaderAccept join all accept types and return -func selectHeaderAccept(accepts []string) string { - if len(accepts) == 0 { - return "" - } - - if contains(accepts, "application/json") { - return "application/json" - } - - return strings.Join(accepts, ",") -} - -// contains is a case insenstive match, finding needle in a haystack -func contains(haystack []string, needle string) bool { - for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { - return true - } - } - return false -} - -// Verify optional parameters are of the correct type. -func typeCheckParameter(obj interface{}, expected string, name string) error { - // Make sure there is an object. - if obj == nil { - return nil - } - - // Check the type is as expected. - if reflect.TypeOf(obj).String() != expected { - return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) - } - return nil -} - -// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. -func parameterToString(obj interface{}, collectionFormat string) string { - var delimiter string - - switch collectionFormat { - case "pipes": - delimiter = "|" - case "ssv": - delimiter = " " - case "tsv": - delimiter = "\t" - case "csv": - delimiter = "," - } - - if reflect.TypeOf(obj).Kind() == reflect.Slice { - return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") - } else if t, ok := obj.(time.Time); ok { - return t.Format(time.RFC3339) - } - - return fmt.Sprintf("%v", obj) -} - -// helper for converting interface{} parameters to json strings -func parameterToJson(obj interface{}) (string, error) { - jsonBuf, err := json.Marshal(obj) - if err != nil { - return "", err - } - return string(jsonBuf), err -} - - -// callAPI do the request. -func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - if c.cfg.Debug { - dump, err := httputil.DumpRequestOut(request, true) - if err != nil { - return nil, err - } - log.Printf("\n%s\n", string(dump)) - } - - resp, err := c.cfg.HTTPClient.Do(request) - if err != nil { - return resp, err - } - - if c.cfg.Debug { - dump, err := httputil.DumpResponse(resp, true) - if err != nil { - return resp, err - } - log.Printf("\n%s\n", string(dump)) - } - return resp, err -} - -// Allow modification of underlying config for alternate implementations and testing -// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior -func (c *APIClient) GetConfig() *Configuration { - return c.cfg -} - -// prepareRequest build the request -func (c *APIClient) prepareRequest( - ctx context.Context, - path string, method string, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams url.Values, - formFileName string, - fileName string, - fileBytes []byte) (localVarRequest *http.Request, err error) { - - var body *bytes.Buffer - - // Detect postBody type and post. - if postBody != nil { - contentType := headerParams["Content-Type"] - if contentType == "" { - contentType = detectContentType(postBody) - headerParams["Content-Type"] = contentType - } - - body, err = setBody(postBody, contentType) - if err != nil { - return nil, err - } - } - - // add form parameters and file if available. - if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { - if body != nil { - return nil, errors.New("Cannot specify postBody and multipart form at the same time.") - } - body = &bytes.Buffer{} - w := multipart.NewWriter(body) - - for k, v := range formParams { - for _, iv := range v { - if strings.HasPrefix(k, "@") { // file - err = addFile(w, k[1:], iv) - if err != nil { - return nil, err - } - } else { // form value - w.WriteField(k, iv) - } - } - } - if len(fileBytes) > 0 && fileName != "" { - w.Boundary() - //_, fileNm := filepath.Split(fileName) - part, err := w.CreateFormFile(formFileName, filepath.Base(fileName)) - if err != nil { - return nil, err - } - _, err = part.Write(fileBytes) - if err != nil { - return nil, err - } - } - - // Set the Boundary in the Content-Type - headerParams["Content-Type"] = w.FormDataContentType() - - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - w.Close() - } - - if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { - if body != nil { - return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") - } - body = &bytes.Buffer{} - body.WriteString(formParams.Encode()) - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - } - - // Setup path and query parameters - url, err := url.Parse(path) - if err != nil { - return nil, err - } - - // Override request host, if applicable - if c.cfg.Host != "" { - url.Host = c.cfg.Host - } - - // Override request scheme, if applicable - if c.cfg.Scheme != "" { - url.Scheme = c.cfg.Scheme - } - - // Adding Query Param - query := url.Query() - for k, v := range queryParams { - for _, iv := range v { - query.Add(k, iv) - } - } - - // Encode the parameters. - url.RawQuery = query.Encode() - - // Generate a new request - if body != nil { - localVarRequest, err = http.NewRequest(method, url.String(), body) - } else { - localVarRequest, err = http.NewRequest(method, url.String(), nil) - } - if err != nil { - return nil, err - } - - // add header parameters, if any - if len(headerParams) > 0 { - headers := http.Header{} - for h, v := range headerParams { - headers.Set(h, v) - } - localVarRequest.Header = headers - } - - // Add the user agent to the request. - localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) - - if ctx != nil { - // add context to the request - localVarRequest = localVarRequest.WithContext(ctx) - - // Walk through any authentication. - - // OAuth2 authentication - if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { - // We were able to grab an oauth2 token from the context - var latestToken *oauth2.Token - if latestToken, err = tok.Token(); err != nil { - return nil, err - } - - latestToken.SetAuthHeader(localVarRequest) - } - - // Basic HTTP Authentication - if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { - localVarRequest.SetBasicAuth(auth.UserName, auth.Password) - } - - // AccessToken Authentication - if auth, ok := ctx.Value(ContextAccessToken).(string); ok { - localVarRequest.Header.Add("Authorization", "Bearer "+auth) - } - - {{#withAWSV4Signature}} - // AWS Signature v4 Authentication - if auth, ok := ctx.Value(ContextAWSv4).(AWSv4); ok { - creds := awscredentials.NewStaticCredentials(auth.AccessKey, auth.SecretKey, "") - signer := awsv4.NewSigner(creds) - var reader *strings.Reader - if body == nil { - reader = strings.NewReader("") - } else { - reader = strings.NewReader(body.String()) - } - timestamp := time.Now() - _, err := signer.Sign(localVarRequest, reader, "oapi", "eu-west-2", timestamp) - if err != nil { - return nil, err - } - } - {{/withAWSV4Signature}} - } - - for header, value := range c.cfg.DefaultHeader { - localVarRequest.Header.Add(header, value) - } -{{#hasHttpSignatureMethods}} - if ctx != nil { - // HTTP Signature Authentication. All request headers must be set (including default headers) - // because the headers may be included in the signature. - if auth, ok := ctx.Value(ContextHttpSignatureAuth).(HttpSignatureAuth); ok { - err = SignRequest(ctx, localVarRequest, auth) - if err != nil { - return nil, err - } - } - } -{{/hasHttpSignatureMethods}} - return localVarRequest, nil -} - -func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { - if len(b) == 0 { - return nil - } - if s, ok := v.(*string); ok { - *s = string(b) - return nil - } - if xmlCheck.MatchString(contentType) { - if err = xml.Unmarshal(b, v); err != nil { - return err - } - return nil - } - if jsonCheck.MatchString(contentType) { - if actualObj, ok := v.(interface{GetActualInstance() interface{}}); ok { // oneOf, anyOf schemas - if unmarshalObj, ok := actualObj.(interface{UnmarshalJSON([]byte) error}); ok { // make sure it has UnmarshalJSON defined - if err = unmarshalObj.UnmarshalJSON(b); err!= nil { - return err - } - } else { - return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") - } - } else if err = json.Unmarshal(b, v); err != nil { // simple model - return err - } - return nil - } - return errors.New("undefined response type") -} - -// Add a file to the multipart request -func addFile(w *multipart.Writer, fieldName, path string) error { - file, err := os.Open(path) - if err != nil { - return err - } - defer file.Close() - - part, err := w.CreateFormFile(fieldName, filepath.Base(path)) - if err != nil { - return err - } - _, err = io.Copy(part, file) - - return err -} - -// Prevent trying to import "fmt" -func reportError(format string, a ...interface{}) error { - return fmt.Errorf(format, a...) -} - -// Prevent trying to import "bytes" -func newStrictDecoder(data []byte) *json.Decoder { - dec := json.NewDecoder(bytes.NewBuffer(data)) - dec.DisallowUnknownFields() - return dec -} - -// Set request body from an interface{} -func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { - if bodyBuf == nil { - bodyBuf = &bytes.Buffer{} - } - - if reader, ok := body.(io.Reader); ok { - _, err = bodyBuf.ReadFrom(reader) - } else if b, ok := body.([]byte); ok { - _, err = bodyBuf.Write(b) - } else if s, ok := body.(string); ok { - _, err = bodyBuf.WriteString(s) - } else if s, ok := body.(*string); ok { - _, err = bodyBuf.WriteString(*s) - } else if jsonCheck.MatchString(contentType) { - err = json.NewEncoder(bodyBuf).Encode(body) - } else if xmlCheck.MatchString(contentType) { - err = xml.NewEncoder(bodyBuf).Encode(body) - } - - if err != nil { - return nil, err - } - - if bodyBuf.Len() == 0 { - err = fmt.Errorf("Invalid body type %s\n", contentType) - return nil, err - } - return bodyBuf, nil -} - -// detectContentType method is used to figure out `Request.Body` content type for request header -func detectContentType(body interface{}) string { - contentType := "text/plain; charset=utf-8" - kind := reflect.TypeOf(body).Kind() - - switch kind { - case reflect.Struct, reflect.Map, reflect.Ptr: - contentType = "application/json; charset=utf-8" - case reflect.String: - contentType = "text/plain; charset=utf-8" - default: - if b, ok := body.([]byte); ok { - contentType = http.DetectContentType(b) - } else if kind == reflect.Slice { - contentType = "application/json; charset=utf-8" - } - } - - return contentType -} - -// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go -type cacheControl map[string]string - -func parseCacheControl(headers http.Header) cacheControl { - cc := cacheControl{} - ccHeader := headers.Get("Cache-Control") - for _, part := range strings.Split(ccHeader, ",") { - part = strings.Trim(part, " ") - if part == "" { - continue - } - if strings.ContainsRune(part, '=') { - keyval := strings.Split(part, "=") - cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") - } else { - cc[part] = "" - } - } - return cc -} - -// CacheExpires helper function to determine remaining time before repeating a request. -func CacheExpires(r *http.Response) time.Time { - // Figure out when the cache expires. - var expires time.Time - now, err := time.Parse(time.RFC1123, r.Header.Get("date")) - if err != nil { - return time.Now() - } - respCacheControl := parseCacheControl(r.Header) - - if maxAge, ok := respCacheControl["max-age"]; ok { - lifetime, err := time.ParseDuration(maxAge + "s") - if err != nil { - expires = now - } else { - expires = now.Add(lifetime) - } - } else { - expiresHeader := r.Header.Get("Expires") - if expiresHeader != "" { - expires, err = time.Parse(time.RFC1123, expiresHeader) - if err != nil { - expires = now - } - } - } - return expires -} - -func strlen(s string) int { - return utf8.RuneCountInString(s) -} - -// GenericOpenAPIError Provides access to the body, error and model on returned errors. -type GenericOpenAPIError struct { - body []byte - error string - model interface{} -} - -// Error returns non-empty string if there was an error. -func (e GenericOpenAPIError) Error() string { - return e.error -} - -// Body returns the raw bytes of the response -func (e GenericOpenAPIError) Body() []byte { - return e.body -} - -// Model returns the unpacked model of the error -func (e GenericOpenAPIError) Model() interface{} { - return e.model -} diff --git a/.schema/openapi/templates/go/configuration.mustache b/.schema/openapi/templates/go/configuration.mustache deleted file mode 100644 index 1f5436d84b7f..000000000000 --- a/.schema/openapi/templates/go/configuration.mustache +++ /dev/null @@ -1,303 +0,0 @@ -{{>partial_header}} -package {{packageName}} - -import ( - "context" - "fmt" - "net/http" - "strings" -) - -// contextKeys are used to identify the type of value in the context. -// Since these are string, it is possible to get a short description of the -// context key for logging and debugging using key.String(). - -type contextKey string - -func (c contextKey) String() string { - return "auth " + string(c) -} - -var ( - // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. - ContextOAuth2 = contextKey("token") - - // ContextBasicAuth takes BasicAuth as authentication for the request. - ContextBasicAuth = contextKey("basic") - - // ContextAccessToken takes a string oauth2 access token as authentication for the request. - ContextAccessToken = contextKey("accesstoken") - - // ContextAPIKeys takes a string apikey as authentication for the request - ContextAPIKeys = contextKey("apiKeys") - - {{#withAWSV4Signature}} - // ContextAWSv4 takes an Access Key and a Secret Key for signing AWS Signature v4 - ContextAWSv4 = contextKey("awsv4") - - {{/withAWSV4Signature}} - // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. - ContextHttpSignatureAuth = contextKey("httpsignature") - - // ContextServerIndex uses a server configuration from the index. - ContextServerIndex = contextKey("serverIndex") - - // ContextOperationServerIndices uses a server configuration from the index mapping. - ContextOperationServerIndices = contextKey("serverOperationIndices") - - // ContextServerVariables overrides a server configuration variables. - ContextServerVariables = contextKey("serverVariables") - - // ContextOperationServerVariables overrides a server configuration variables using operation specific values. - ContextOperationServerVariables = contextKey("serverOperationVariables") -) - -// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth -type BasicAuth struct { - UserName string `json:"userName,omitempty"` - Password string `json:"password,omitempty"` -} - -// APIKey provides API key based authentication to a request passed via context using ContextAPIKey -type APIKey struct { - Key string - Prefix string -} - -{{#withAWSV4Signature}} -// AWSv4 provides AWS Signature to a request passed via context using ContextAWSv4 -// https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html -type AWSv4 struct { - AccessKey string - SecretKey string -} - -{{/withAWSV4Signature}} -// ServerVariable stores the information about a server variable -type ServerVariable struct { - Description string - DefaultValue string - EnumValues []string -} - -// ServerConfiguration stores the information about a server -type ServerConfiguration struct { - URL string - Description string - Variables map[string]ServerVariable -} - -// ServerConfigurations stores multiple ServerConfiguration items -type ServerConfigurations []ServerConfiguration - -// Configuration stores the configuration of the API client -type Configuration struct { - Host string `json:"host,omitempty"` - Scheme string `json:"scheme,omitempty"` - DefaultHeader map[string]string `json:"defaultHeader,omitempty"` - UserAgent string `json:"userAgent,omitempty"` - Debug bool `json:"debug,omitempty"` - Servers ServerConfigurations - OperationServers map[string]ServerConfigurations - HTTPClient *http.Client -} - -// NewConfiguration returns a new Configuration object -func NewConfiguration() *Configuration { - cfg := &Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/go{{/httpUserAgent}}", - Debug: false, - {{#servers}} - {{#-first}} - Servers: ServerConfigurations{ - {{/-first}} - { - URL: "{{{url}}}", - Description: "{{{description}}}{{^description}}No description provided{{/description}}", - {{#variables}} - {{#-first}} - Variables: map[string]ServerVariable{ - {{/-first}} - "{{{name}}}": ServerVariable{ - Description: "{{{description}}}{{^description}}No description provided{{/description}}", - DefaultValue: "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - EnumValues: []string{ - {{/-first}} - "{{{.}}}", - {{#-last}} - }, - {{/-last}} - {{/enumValues}} - }, - {{#-last}} - }, - {{/-last}} - {{/variables}} - }, - {{#-last}} - }, - {{/-last}} - {{/servers}} - {{#apiInfo}} - OperationServers: map[string]ServerConfigurations{ - {{#apis}} - {{#operations}} - {{#operation}} - {{#servers}} - {{#-first}} - "{{{classname}}}Service.{{{nickname}}}": { - {{/-first}} - { - URL: "{{{url}}}", - Description: "{{{description}}}{{^description}}No description provided{{/description}}", - {{#variables}} - {{#-first}} - Variables: map[string]ServerVariable{ - {{/-first}} - "{{{name}}}": ServerVariable{ - Description: "{{{description}}}{{^description}}No description provided{{/description}}", - DefaultValue: "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - EnumValues: []string{ - {{/-first}} - "{{{.}}}", - {{#-last}} - }, - {{/-last}} - {{/enumValues}} - }, - {{#-last}} - }, - {{/-last}} - {{/variables}} - }, - {{#-last}} - }, - {{/-last}} - {{/servers}} - {{/operation}} - {{/operations}} - {{/apis}} - }, - {{/apiInfo}} - } - return cfg -} - -// AddDefaultHeader adds a new HTTP header to the default header in the request -func (c *Configuration) AddDefaultHeader(key string, value string) { - c.DefaultHeader[key] = value -} - -// URL formats template on a index using given variables -func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { - if index < 0 || len(sc) <= index { - return "", fmt.Errorf("Index %v out of range %v", index, len(sc)-1) - } - server := sc[index] - url := server.URL - - // go through variables and replace placeholders - for name, variable := range server.Variables { - if value, ok := variables[name]; ok { - found := bool(len(variable.EnumValues) == 0) - for _, enumValue := range variable.EnumValues { - if value == enumValue { - found = true - } - } - if !found { - return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) - } - url = strings.Replace(url, "{"+name+"}", value, -1) - } else { - url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) - } - } - return url, nil -} - -// ServerURL returns URL based on server settings -func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { - return c.Servers.URL(index, variables) -} - -func getServerIndex(ctx context.Context) (int, error) { - si := ctx.Value(ContextServerIndex) - if si != nil { - if index, ok := si.(int); ok { - return index, nil - } - return 0, reportError("Invalid type %T should be int", si) - } - return 0, nil -} - -func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { - osi := ctx.Value(ContextOperationServerIndices) - if osi != nil { - if operationIndices, ok := osi.(map[string]int); !ok { - return 0, reportError("Invalid type %T should be map[string]int", osi) - } else { - index, ok := operationIndices[endpoint] - if ok { - return index, nil - } - } - } - return getServerIndex(ctx) -} - -func getServerVariables(ctx context.Context) (map[string]string, error) { - sv := ctx.Value(ContextServerVariables) - if sv != nil { - if variables, ok := sv.(map[string]string); ok { - return variables, nil - } - return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) - } - return nil, nil -} - -func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { - osv := ctx.Value(ContextOperationServerVariables) - if osv != nil { - if operationVariables, ok := osv.(map[string]map[string]string); !ok { - return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) - } else { - variables, ok := operationVariables[endpoint] - if ok { - return variables, nil - } - } - } - return getServerVariables(ctx) -} - -// ServerURLWithContext returns a new server URL given an endpoint -func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { - sc, ok := c.OperationServers[endpoint] - if !ok { - sc = c.Servers - } - - if ctx == nil { - return sc.URL(0, nil) - } - - index, err := getServerOperationIndex(ctx, endpoint) - if err != nil { - return "", err - } - - variables, err := getServerOperationVariables(ctx, endpoint) - if err != nil { - return "", err - } - - return sc.URL(index, variables) -} diff --git a/.schema/openapi/templates/go/git_push.sh.mustache b/.schema/openapi/templates/go/git_push.sh.mustache deleted file mode 100755 index 8b3f689c9121..000000000000 --- a/.schema/openapi/templates/go/git_push.sh.mustache +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="{{{gitHost}}}" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="{{{gitUserId}}}" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="{{{gitRepoId}}}" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="{{{releaseNote}}}" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/.schema/openapi/templates/go/gitignore.mustache b/.schema/openapi/templates/go/gitignore.mustache deleted file mode 100644 index daf913b1b347..000000000000 --- a/.schema/openapi/templates/go/gitignore.mustache +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof diff --git a/.schema/openapi/templates/go/go.mod.mustache b/.schema/openapi/templates/go/go.mod.mustache deleted file mode 100644 index 21fcfdeb96e9..000000000000 --- a/.schema/openapi/templates/go/go.mod.mustache +++ /dev/null @@ -1,10 +0,0 @@ -module {{gitHost}}/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}{{/isGoSubmodule}} - -go 1.13 - -require ( - golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 - {{#withAWSV4Signature}} - github.com/aws/aws-sdk-go v1.34.14 - {{/withAWSV4Signature}} -) diff --git a/.schema/openapi/templates/go/go.sum b/.schema/openapi/templates/go/go.sum deleted file mode 100644 index 734252e68153..000000000000 --- a/.schema/openapi/templates/go/go.sum +++ /dev/null @@ -1,13 +0,0 @@ -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/.schema/openapi/templates/go/model.mustache b/.schema/openapi/templates/go/model.mustache deleted file mode 100644 index 684af1d33c64..000000000000 --- a/.schema/openapi/templates/go/model.mustache +++ /dev/null @@ -1,20 +0,0 @@ -{{>partial_header}} -package {{packageName}} - -{{#models}} -import ( - "encoding/json" -{{#imports}} - "{{import}}" -{{/imports}} -) - -{{#model}} -{{#isEnum}} -{{>model_enum}} -{{/isEnum}} -{{^isEnum}} -{{#oneOf}}{{#-first}}{{>model_oneof}}{{/-first}}{{/oneOf}}{{^oneOf}}{{#anyOf}}{{#-first}}{{>model_anyof}}{{/-first}}{{/anyOf}}{{^anyOf}}{{>model_simple}}{{/anyOf}}{{/oneOf}} -{{/isEnum}} -{{/model}} -{{/models}} diff --git a/.schema/openapi/templates/go/model_anyof.mustache b/.schema/openapi/templates/go/model_anyof.mustache deleted file mode 100644 index a43f48a2f55b..000000000000 --- a/.schema/openapi/templates/go/model_anyof.mustache +++ /dev/null @@ -1,76 +0,0 @@ -// {{classname}}{{#description}} {{{description}}}{{/description}}{{^description}} struct for {{{classname}}}{{/description}} -type {{classname}} struct { - {{#anyOf}} - {{{.}}} *{{{.}}} - {{/anyOf}} -} - -// Unmarshal JSON data into any of the pointers in the struct -func (dst *{{classname}}) UnmarshalJSON(data []byte) error { - var err error - {{#isNullable}} - // this object is nullable so check if the payload is null or empty string - if string(data) == "" || string(data) == "{}" { - return nil - } - - {{/isNullable}} - {{#discriminator}} - {{#mappedModels}} - {{#-first}} - // use discriminator value to speed up the lookup - var jsonDict map[string]interface{} - err = json.Unmarshal(data, &jsonDict) - if err != nil { - return fmt.Errorf("Failed to unmarshal JSON into map for the discrimintor lookup.") - } - - {{/-first}} - // check if the discriminator value is '{{{mappingName}}}' - if jsonDict["{{{propertyBaseName}}}"] == "{{{mappingName}}}" { - // try to unmarshal JSON data into {{{modelName}}} - err = json.Unmarshal(data, &dst.{{{modelName}}}); - if err == nil { - json{{{modelName}}}, _ := json.Marshal(dst.{{{modelName}}}) - if string(json{{{modelName}}}) == "{}" { // empty struct - dst.{{{modelName}}} = nil - } else { - return nil // data stored in dst.{{{modelName}}}, return on the first match - } - } else { - dst.{{{modelName}}} = nil - } - } - - {{/mappedModels}} - {{/discriminator}} - {{#anyOf}} - // try to unmarshal JSON data into {{{.}}} - err = json.Unmarshal(data, &dst.{{{.}}}); - if err == nil { - json{{{.}}}, _ := json.Marshal(dst.{{{.}}}) - if string(json{{{.}}}) == "{}" { // empty struct - dst.{{{.}}} = nil - } else { - return nil // data stored in dst.{{{.}}}, return on the first match - } - } else { - dst.{{{.}}} = nil - } - - {{/anyOf}} - return fmt.Errorf("Data failed to match schemas in anyOf({{classname}})") -} - -// Marshal data from the first non-nil pointers in the struct to JSON -func (src *{{classname}}) MarshalJSON() ([]byte, error) { -{{#anyOf}} - if src.{{{.}}} != nil { - return json.Marshal(&src.{{{.}}}) - } - -{{/anyOf}} - return nil, nil // no data in anyOf schemas -} - -{{>nullable_model}} diff --git a/.schema/openapi/templates/go/model_doc.mustache b/.schema/openapi/templates/go/model_doc.mustache deleted file mode 100644 index 439e695b1f5f..000000000000 --- a/.schema/openapi/templates/go/model_doc.mustache +++ /dev/null @@ -1,97 +0,0 @@ -{{#models}}{{#model}}# {{classname}} - -{{^isEnum}} -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -{{#vendorExtensions.x-is-one-of-interface}} -**{{classname}}Interface** | **interface { {{#discriminator}}{{propertyGetter}}() {{propertyType}}{{/discriminator}} }** | An interface that can hold any of the proper implementing types | -{{/vendorExtensions.x-is-one-of-interface}} -{{^vendorExtensions.x-is-one-of-interface}} -{{#vars}}**{{name}}** | {{^required}}Pointer to {{/required}}{{#isContainer}}{{#isArray}}{{#items}}{{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**[]{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{dataType}}.md){{/isFile}}{{/isPrimitiveType}}{{/items}}{{/isArray}}{{#isMap}}{{#items}}{{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**map[string]{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}{{/items}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{^isPrimitiveType}}{{^isFile}}{{^isDateTime}}[{{/isDateTime}}{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}{{^isDateTime}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isDateTime}}{{/isFile}}{{/isPrimitiveType}}{{/isContainer}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} -{{/vars}} -{{/vendorExtensions.x-is-one-of-interface}} - -## Methods - -{{^vendorExtensions.x-is-one-of-interface}} -### New{{classname}} - -`func New{{classname}}({{#vars}}{{#required}}{{nameInCamelCase}} {{dataType}}, {{/required}}{{/vars}}) *{{classname}}` - -New{{classname}} instantiates a new {{classname}} object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### New{{classname}}WithDefaults - -`func New{{classname}}WithDefaults() *{{classname}}` - -New{{classname}}WithDefaults instantiates a new {{classname}} object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -{{#vars}} -### Get{{name}} - -`func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-go-base-type}}` - -Get{{name}} returns the {{name}} field if non-nil, zero value otherwise. - -### Get{{name}}Ok - -`func (o *{{classname}}) Get{{name}}Ok() (*{{vendorExtensions.x-go-base-type}}, bool)` - -Get{{name}}Ok returns a tuple with the {{name}} field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### Set{{name}} - -`func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-go-base-type}})` - -Set{{name}} sets {{name}} field to given value. - -{{^required}} -### Has{{name}} - -`func (o *{{classname}}) Has{{name}}() bool` - -Has{{name}} returns a boolean if a field has been set. -{{/required}} - -{{#isNullable}} -### Set{{name}}Nil - -`func (o *{{classname}}) Set{{name}}Nil(b bool)` - - Set{{name}}Nil sets the value for {{name}} to be an explicit nil - -### Unset{{name}} -`func (o *{{classname}}) Unset{{name}}()` - -Unset{{name}} ensures that no value is present for {{name}}, not even an explicit nil -{{/isNullable}} -{{/vars}} -{{#vendorExtensions.x-implements}} - -### As{{{.}}} - -`func (s *{{classname}}) As{{{.}}}() {{{.}}}` - -Convenience method to wrap this instance of {{classname}} in {{{.}}} -{{/vendorExtensions.x-implements}} -{{/vendorExtensions.x-is-one-of-interface}} -{{/isEnum}} -{{#isEnum}} -## Enum - -{{#allowableValues}}{{#enumVars}} -* `{{name}}` (value: `{{{value}}}`) -{{/enumVars}}{{/allowableValues}} -{{/isEnum}} - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - -{{/model}}{{/models}} diff --git a/.schema/openapi/templates/go/model_enum.mustache b/.schema/openapi/templates/go/model_enum.mustache deleted file mode 100644 index 1d3c2244c098..000000000000 --- a/.schema/openapi/templates/go/model_enum.mustache +++ /dev/null @@ -1,71 +0,0 @@ -// {{{classname}}} {{#description}}{{{.}}}{{/description}}{{^description}}the model '{{{classname}}}'{{/description}} -type {{{classname}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}} - -// List of {{{name}}} -const ( - {{#allowableValues}} - {{#enumVars}} - {{^-first}} - {{/-first}} - {{#enumClassPrefix}}{{{classname.toUpperCase}}}_{{/enumClassPrefix}}{{name}} {{{classname}}} = {{{value}}} - {{/enumVars}} - {{/allowableValues}} -) - -func (v *{{{classname}}}) UnmarshalJSON(src []byte) error { - var value {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}} - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := {{{classname}}}(value) - for _, existing := range []{{classname}}{ {{#allowableValues}}{{#enumVars}}{{{value}}}, {{/enumVars}} {{/allowableValues}} } { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid {{classname}}", value) -} - -// Ptr returns reference to {{{name}}} value -func (v {{{classname}}}) Ptr() *{{{classname}}} { - return &v -} - -type Nullable{{{classname}}} struct { - value *{{{classname}}} - isSet bool -} - -func (v Nullable{{classname}}) Get() *{{classname}} { - return v.value -} - -func (v *Nullable{{classname}}) Set(val *{{classname}}) { - v.value = val - v.isSet = true -} - -func (v Nullable{{classname}}) IsSet() bool { - return v.isSet -} - -func (v *Nullable{{classname}}) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullable{{classname}}(val *{{classname}}) *Nullable{{classname}} { - return &Nullable{{classname}}{value: val, isSet: true} -} - -func (v Nullable{{{classname}}}) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *Nullable{{{classname}}}) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/.schema/openapi/templates/go/model_oneof.mustache b/.schema/openapi/templates/go/model_oneof.mustache deleted file mode 100644 index cc4960b81079..000000000000 --- a/.schema/openapi/templates/go/model_oneof.mustache +++ /dev/null @@ -1,114 +0,0 @@ -// {{classname}} - {{#description}}{{{description}}}{{/description}}{{^description}}struct for {{{classname}}}{{/description}} -type {{classname}} struct { - {{#oneOf}} - {{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}} *{{{.}}} - {{/oneOf}} -} - -{{#oneOf}} -// {{{.}}}As{{classname}} is a convenience function that returns {{{.}}} wrapped in {{classname}} -func {{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}}As{{classname}}(v *{{{.}}}) {{classname}} { - return {{classname}}{ - {{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}}: v, - } -} - -{{/oneOf}} - -// Unmarshal JSON data into one of the pointers in the struct -func (dst *{{classname}}) UnmarshalJSON(data []byte) error { - var err error - {{#isNullable}} - // this object is nullable so check if the payload is null or empty string - if string(data) == "" || string(data) == "{}" { - return nil - } - - {{/isNullable}} - {{#useOneOfDiscriminatorLookup}} - {{#discriminator}} - {{#mappedModels}} - {{#-first}} - // use discriminator value to speed up the lookup - var jsonDict map[string]interface{} - err = newStrictDecoder(data).Decode(&jsonDict) - if err != nil { - return fmt.Errorf("Failed to unmarshal JSON into map for the discrimintor lookup.") - } - - {{/-first}} - // check if the discriminator value is '{{{mappingName}}}' - if jsonDict["{{{propertyBaseName}}}"] == "{{{mappingName}}}" { - // try to unmarshal JSON data into {{{modelName}}} - err = json.Unmarshal(data, &dst.{{{modelName}}}) - if err == nil { - return nil // data stored in dst.{{{modelName}}}, return on the first match - } else { - dst.{{{modelName}}} = nil - return fmt.Errorf("Failed to unmarshal {{classname}} as {{{modelName}}}: %s", err.Error()) - } - } - - {{/mappedModels}} - {{/discriminator}} - return nil - {{/useOneOfDiscriminatorLookup}} - {{^useOneOfDiscriminatorLookup}} - match := 0 - {{#oneOf}} - // try to unmarshal data into {{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}} - err = newStrictDecoder(data).Decode(&dst.{{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}}) - if err == nil { - json{{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}}, _ := json.Marshal(dst.{{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}}) - if string(json{{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}}) == "{}" { // empty struct - dst.{{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}} = nil - } else { - match++ - } - } else { - dst.{{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}} = nil - } - - {{/oneOf}} - if match > 1 { // more than 1 match - // reset to nil - {{#oneOf}} - dst.{{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}} = nil - {{/oneOf}} - - return fmt.Errorf("Data matches more than one schema in oneOf({{classname}})") - } else if match == 1 { - return nil // exactly one match - } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf({{classname}})") - } - {{/useOneOfDiscriminatorLookup}} -} - -// Marshal data from the first non-nil pointers in the struct to JSON -func (src {{classname}}) MarshalJSON() ([]byte, error) { -{{#oneOf}} - if src.{{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}} != nil { - return json.Marshal(&src.{{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}}) - } - -{{/oneOf}} - return nil, nil // no data in oneOf schemas -} - -// Get the actual instance -func (obj *{{classname}}) GetActualInstance() (interface{}) { - if obj == nil { - return nil - } -{{#oneOf}} - if obj.{{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}} != nil { - return obj.{{#lambda.titlecase}}{{{.}}}{{/lambda.titlecase}} - } - -{{/oneOf}} - // all schemas are nil - return nil -} - -{{>nullable_model}} diff --git a/.schema/openapi/templates/go/model_simple.mustache b/.schema/openapi/templates/go/model_simple.mustache deleted file mode 100644 index 74bd5458a9ef..000000000000 --- a/.schema/openapi/templates/go/model_simple.mustache +++ /dev/null @@ -1,391 +0,0 @@ -// {{classname}}{{#description}} {{{description}}}{{/description}}{{^description}} struct for {{{classname}}}{{/description}} -type {{classname}} struct { -{{#parent}} -{{^isMap}} -{{^isArray}} - {{{parent}}} -{{/isArray}} -{{/isMap}} -{{#isArray}} - Items {{{parent}}} -{{/isArray}} -{{/parent}} -{{#vars}} -{{^-first}} -{{/-first}} -{{#description}} - // {{{description}}} -{{/description}} - {{name}} {{^required}}{{^isNullable}}{{^isArray}}{{^isFreeFormObject}}*{{/isFreeFormObject}}{{/isArray}}{{/isNullable}}{{/required}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` -{{/vars}} -{{#isAdditionalPropertiesTrue}} - AdditionalProperties map[string]interface{} -{{/isAdditionalPropertiesTrue}} -} - -{{#isAdditionalPropertiesTrue}} -type _{{{classname}}} {{{classname}}} - -{{/isAdditionalPropertiesTrue}} -// New{{classname}} instantiates a new {{classname}} object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func New{{classname}}({{#vars}}{{#required}}{{nameInCamelCase}} {{dataType}}, {{/required}}{{/vars}}) *{{classname}} { - this := {{classname}}{} -{{#vars}} -{{#required}} - this.{{name}} = {{nameInCamelCase}} -{{/required}} -{{^required}} -{{#defaultValue}} -{{^vendorExtensions.x-golang-is-container}} -{{#isNullable}} - var {{nameInCamelCase}} {{{datatypeWithEnum}}} = {{{.}}} - this.{{name}} = *New{{{dataType}}}(&{{nameInCamelCase}}) -{{/isNullable}} -{{^isNullable}} - var {{nameInCamelCase}} {{{dataType}}} = {{{.}}} - this.{{name}} = &{{nameInCamelCase}} -{{/isNullable}} -{{/vendorExtensions.x-golang-is-container}} -{{/defaultValue}} -{{/required}} -{{/vars}} - return &this -} - -// New{{classname}}WithDefaults instantiates a new {{classname}} object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func New{{classname}}WithDefaults() *{{classname}} { - this := {{classname}}{} -{{#vars}} -{{#defaultValue}} -{{^vendorExtensions.x-golang-is-container}} -{{#isNullable}} -{{!we use datatypeWithEnum here, since it will represent the non-nullable name of the datatype, e.g. int64 for NullableInt64}} - var {{nameInCamelCase}} {{{datatypeWithEnum}}} = {{{.}}} - this.{{name}} = *New{{{dataType}}}(&{{nameInCamelCase}}) -{{/isNullable}} -{{^isNullable}} - var {{nameInCamelCase}} {{{dataType}}} = {{{.}}} - this.{{name}} = {{^required}}&{{/required}}{{nameInCamelCase}} -{{/isNullable}} -{{/vendorExtensions.x-golang-is-container}} -{{/defaultValue}} -{{/vars}} - return &this -} - -{{#vars}} -{{#required}} -// Get{{name}} returns the {{name}} field value -{{#isNullable}} -// If the value is explicit nil, the zero value for {{vendorExtensions.x-go-base-type}} will be returned -{{/isNullable}} -func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-go-base-type}} { - if o == nil {{#isNullable}}{{^vendorExtensions.x-golang-is-container}}|| o.{{name}}.Get() == nil{{/vendorExtensions.x-golang-is-container}}{{/isNullable}} { - var ret {{vendorExtensions.x-go-base-type}} - return ret - } - -{{#isNullable}} -{{#vendorExtensions.x-golang-is-container}} - return o.{{name}} -{{/vendorExtensions.x-golang-is-container}} -{{^vendorExtensions.x-golang-is-container}} - return *o.{{name}}.Get() -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} -{{^isNullable}} - return o.{{name}} -{{/isNullable}} -} - -// Get{{name}}Ok returns a tuple with the {{name}} field value -// and a boolean to check if the value has been set. -{{#isNullable}} -// NOTE: If the value is an explicit nil, `nil, true` will be returned -{{/isNullable}} -func (o *{{classname}}) Get{{name}}Ok() ({{^isArray}}{{^isFreeFormObject}}*{{/isFreeFormObject}}{{/isArray}}{{vendorExtensions.x-go-base-type}}, bool) { - if o == nil {{#isNullable}}{{#vendorExtensions.x-golang-is-container}}|| o.{{name}} == nil{{/vendorExtensions.x-golang-is-container}}{{/isNullable}} { - return nil, false - } -{{#isNullable}} -{{#vendorExtensions.x-golang-is-container}} - return {{^isArray}}{{^isFreeFormObject}}&{{/isFreeFormObject}}{{/isArray}}o.{{name}}, true -{{/vendorExtensions.x-golang-is-container}} -{{^vendorExtensions.x-golang-is-container}} - return o.{{name}}.Get(), o.{{name}}.IsSet() -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} -{{^isNullable}} - return {{^isArray}}{{^isFreeFormObject}}&{{/isFreeFormObject}}{{/isArray}}o.{{name}}, true -{{/isNullable}} -} - -// Set{{name}} sets field value -func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-go-base-type}}) { -{{#isNullable}} -{{#vendorExtensions.x-golang-is-container}} - o.{{name}} = v -{{/vendorExtensions.x-golang-is-container}} -{{^vendorExtensions.x-golang-is-container}} - o.{{name}}.Set(&v) -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} -{{^isNullable}} - o.{{name}} = v -{{/isNullable}} -} - -{{/required}} -{{^required}} -// Get{{name}} returns the {{name}} field value if set, zero value otherwise{{#isNullable}} (both if not set or set to explicit null){{/isNullable}}. -func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-go-base-type}} { - if o == nil {{^isNullable}}|| o.{{name}} == nil{{/isNullable}}{{#isNullable}}{{^vendorExtensions.x-golang-is-container}}|| o.{{name}}.Get() == nil{{/vendorExtensions.x-golang-is-container}}{{/isNullable}} { - var ret {{vendorExtensions.x-go-base-type}} - return ret - } -{{#isNullable}} -{{#vendorExtensions.x-golang-is-container}} - return o.{{name}} -{{/vendorExtensions.x-golang-is-container}} -{{^vendorExtensions.x-golang-is-container}} - return *o.{{name}}.Get() -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} -{{^isNullable}} - return {{^isArray}}{{^isFreeFormObject}}*{{/isFreeFormObject}}{{/isArray}}o.{{name}} -{{/isNullable}} -} - -// Get{{name}}Ok returns a tuple with the {{name}} field value if set, nil otherwise -// and a boolean to check if the value has been set. -{{#isNullable}} -// NOTE: If the value is an explicit nil, `nil, true` will be returned -{{/isNullable}} -func (o *{{classname}}) Get{{name}}Ok() ({{^isArray}}{{^isFreeFormObject}}*{{/isFreeFormObject}}{{/isArray}}{{vendorExtensions.x-go-base-type}}, bool) { - if o == nil {{^isNullable}}|| o.{{name}} == nil{{/isNullable}}{{#isNullable}}{{#vendorExtensions.x-golang-is-container}}|| o.{{name}} == nil{{/vendorExtensions.x-golang-is-container}}{{/isNullable}} { - return nil, false - } -{{#isNullable}} -{{#vendorExtensions.x-golang-is-container}} - return {{^isArray}}{{^isFreeFormObject}}&{{/isFreeFormObject}}{{/isArray}}o.{{name}}, true -{{/vendorExtensions.x-golang-is-container}} -{{^vendorExtensions.x-golang-is-container}} - return o.{{name}}.Get(), o.{{name}}.IsSet() -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} -{{^isNullable}} - return o.{{name}}, true -{{/isNullable}} -} - -// Has{{name}} returns a boolean if a field has been set. -func (o *{{classname}}) Has{{name}}() bool { - if o != nil && {{^isNullable}}o.{{name}} != nil{{/isNullable}}{{#isNullable}}{{#vendorExtensions.x-golang-is-container}}o.{{name}} != nil{{/vendorExtensions.x-golang-is-container}}{{^vendorExtensions.x-golang-is-container}}o.{{name}}.IsSet(){{/vendorExtensions.x-golang-is-container}}{{/isNullable}} { - return true - } - - return false -} - -// Set{{name}} gets a reference to the given {{dataType}} and assigns it to the {{name}} field. -func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-go-base-type}}) { -{{#isNullable}} -{{#vendorExtensions.x-golang-is-container}} - o.{{name}} = v -{{/vendorExtensions.x-golang-is-container}} -{{^vendorExtensions.x-golang-is-container}} - o.{{name}}.Set({{^isArray}}{{^isFreeFormObject}}&{{/isFreeFormObject}}{{/isArray}}v) -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} -{{^isNullable}} - o.{{name}} = {{^isArray}}{{^isFreeFormObject}}&{{/isFreeFormObject}}{{/isArray}}v -{{/isNullable}} -} -{{#isNullable}} -{{^vendorExtensions.x-golang-is-container}} -// Set{{name}}Nil sets the value for {{name}} to be an explicit nil -func (o *{{classname}}) Set{{name}}Nil() { - o.{{name}}.Set(nil) -} - -// Unset{{name}} ensures that no value is present for {{name}}, not even an explicit nil -func (o *{{classname}}) Unset{{name}}() { - o.{{name}}.Unset() -} -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} - -{{/required}} -{{/vars}} -func (o {{classname}}) MarshalJSON() ([]byte, error) { - toSerialize := {{#isArray}}make([]interface{}, len(o.Items)){{/isArray}}{{^isArray}}map[string]interface{}{}{{/isArray}} - {{#parent}} - {{^isMap}} - {{^isArray}} - serialized{{parent}}, err{{parent}} := json.Marshal(o.{{parent}}) - if err{{parent}} != nil { - return []byte{}, err{{parent}} - } - err{{parent}} = json.Unmarshal([]byte(serialized{{parent}}), &toSerialize) - if err{{parent}} != nil { - return []byte{}, err{{parent}} - } - {{/isArray}} - {{/isMap}} - {{#isArray}} - for i, item := range o.Items { - toSerialize[i] = item - } - {{/isArray}} - {{/parent}} - {{#vars}} - {{! if argument is nullable, only serialize it if it is set}} - {{#isNullable}} - {{#vendorExtensions.x-golang-is-container}} - {{! support for container fields is not ideal at this point because of lack of Nullable* types}} - if o.{{name}} != nil { - toSerialize["{{baseName}}"] = o.{{name}} - } - {{/vendorExtensions.x-golang-is-container}} - {{^vendorExtensions.x-golang-is-container}} - if {{#required}}true{{/required}}{{^required}}o.{{name}}.IsSet(){{/required}} { - toSerialize["{{baseName}}"] = o.{{name}}.Get() - } - {{/vendorExtensions.x-golang-is-container}} - {{/isNullable}} - {{! if argument is not nullable, don't set it if it is nil}} - {{^isNullable}} - if {{#required}}true{{/required}}{{^required}}o.{{name}} != nil{{/required}} { - toSerialize["{{baseName}}"] = o.{{name}} - } - {{/isNullable}} - {{/vars}} - {{#isAdditionalPropertiesTrue}} - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - {{/isAdditionalPropertiesTrue}} - return json.Marshal(toSerialize) -} - -{{#isAdditionalPropertiesTrue}} -func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) { -{{#parent}} -{{^isMap}} - type {{classname}}WithoutEmbeddedStruct struct { - {{#vars}} - {{^-first}} - {{/-first}} - {{#description}} - // {{{description}}} - {{/description}} - {{name}} {{^required}}{{^isNullable}}*{{/isNullable}}{{/required}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` - {{/vars}} - } - - var{{{classname}}}WithoutEmbeddedStruct := {{{classname}}}WithoutEmbeddedStruct{} - - err = json.Unmarshal(bytes, &var{{{classname}}}WithoutEmbeddedStruct) - if err == nil { - var{{{classname}}} := _{{{classname}}}{} - {{#vars}} - var{{{classname}}}.{{{name}}} = var{{{classname}}}WithoutEmbeddedStruct.{{{name}}} - {{/vars}} - *o = {{{classname}}}(var{{{classname}}}) - } else { - return err - } - - var{{{classname}}} := _{{{classname}}}{} - - err = json.Unmarshal(bytes, &var{{{classname}}}) - if err == nil { - o.{{{parent}}} = var{{{classname}}}.{{{parent}}} - } else { - return err - } - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - {{#vars}} - delete(additionalProperties, "{{{baseName}}}") - {{/vars}} - - // remove fields from embedded structs - reflect{{{parent}}} := reflect.ValueOf(o.{{{parent}}}) - for i := 0; i < reflect{{{parent}}}.Type().NumField(); i++ { - t := reflect{{{parent}}}.Type().Field(i) - - if jsonTag := t.Tag.Get("json"); jsonTag != "" { - fieldName := "" - if commaIdx := strings.Index(jsonTag, ","); commaIdx > 0 { - fieldName = jsonTag[:commaIdx] - } else { - fieldName = jsonTag - } - if fieldName != "AdditionalProperties" { - delete(additionalProperties, fieldName) - } - } - } - - o.AdditionalProperties = additionalProperties - } - - return err -{{/isMap}} -{{#isMap}} - var{{{classname}}} := _{{{classname}}}{} - - if err = json.Unmarshal(bytes, &var{{{classname}}}); err == nil { - *o = {{{classname}}}(var{{{classname}}}) - } - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - {{#vars}} - delete(additionalProperties, "{{{baseName}}}") - {{/vars}} - o.AdditionalProperties = additionalProperties - } - - return err -{{/isMap}} -{{/parent}} -{{^parent}} - var{{{classname}}} := _{{{classname}}}{} - - if err = json.Unmarshal(bytes, &var{{{classname}}}); err == nil { - *o = {{{classname}}}(var{{{classname}}}) - } - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - {{#vars}} - delete(additionalProperties, "{{{baseName}}}") - {{/vars}} - o.AdditionalProperties = additionalProperties - } - - return err -{{/parent}} -} - -{{/isAdditionalPropertiesTrue}} -{{#isArray}} -func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) { - return json.Unmarshal(bytes, &o.Items) -} - -{{/isArray}} -{{>nullable_model}} diff --git a/.schema/openapi/templates/go/nullable_model.mustache b/.schema/openapi/templates/go/nullable_model.mustache deleted file mode 100644 index 7b60ce6d3a15..000000000000 --- a/.schema/openapi/templates/go/nullable_model.mustache +++ /dev/null @@ -1,35 +0,0 @@ -type Nullable{{{classname}}} struct { - value {{^isArray}}{{^isFreeFormObject}}*{{/isFreeFormObject}}{{/isArray}}{{{classname}}} - isSet bool -} - -func (v Nullable{{classname}}) Get() {{^isArray}}{{^isFreeFormObject}}*{{/isFreeFormObject}}{{/isArray}}{{classname}} { - return v.value -} - -func (v *Nullable{{classname}}) Set(val {{^isArray}}{{^isFreeFormObject}}*{{/isFreeFormObject}}{{/isArray}}{{classname}}) { - v.value = val - v.isSet = true -} - -func (v Nullable{{classname}}) IsSet() bool { - return v.isSet -} - -func (v *Nullable{{classname}}) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullable{{classname}}(val {{^isArray}}{{^isFreeFormObject}}*{{/isFreeFormObject}}{{/isArray}}{{classname}}) *Nullable{{classname}} { - return &Nullable{{classname}}{value: val, isSet: true} -} - -func (v Nullable{{{classname}}}) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *Nullable{{{classname}}}) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/.schema/openapi/templates/go/openapi.mustache b/.schema/openapi/templates/go/openapi.mustache deleted file mode 100644 index 51ebafb0187d..000000000000 --- a/.schema/openapi/templates/go/openapi.mustache +++ /dev/null @@ -1 +0,0 @@ -{{{openapi-yaml}}} \ No newline at end of file diff --git a/.schema/openapi/templates/go/partial_header.mustache b/.schema/openapi/templates/go/partial_header.mustache deleted file mode 100644 index ee1ead4cf395..000000000000 --- a/.schema/openapi/templates/go/partial_header.mustache +++ /dev/null @@ -1,18 +0,0 @@ -/* - {{#appName}} - * {{{appName}}} - * - {{/appName}} - {{#appDescription}} - * {{{appDescription}}} - * - {{/appDescription}} - {{#version}} - * API version: {{{version}}} - {{/version}} - {{#infoEmail}} - * Contact: {{{infoEmail}}} - {{/infoEmail}} - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/.schema/openapi/templates/go/response.mustache b/.schema/openapi/templates/go/response.mustache deleted file mode 100644 index 1a8765bae8f1..000000000000 --- a/.schema/openapi/templates/go/response.mustache +++ /dev/null @@ -1,38 +0,0 @@ -{{>partial_header}} -package {{packageName}} - -import ( - "net/http" -) - -// APIResponse stores the API response returned by the server. -type APIResponse struct { - *http.Response `json:"-"` - Message string `json:"message,omitempty"` - // Operation is the name of the OpenAPI operation. - Operation string `json:"operation,omitempty"` - // RequestURL is the request URL. This value is always available, even if the - // embedded *http.Response is nil. - RequestURL string `json:"url,omitempty"` - // Method is the HTTP method used for the request. This value is always - // available, even if the embedded *http.Response is nil. - Method string `json:"method,omitempty"` - // Payload holds the contents of the response body (which may be nil or empty). - // This is provided here as the raw response.Body() reader will have already - // been drained. - Payload []byte `json:"-"` -} - -// NewAPIResponse returns a new APIResonse object. -func NewAPIResponse(r *http.Response) *APIResponse { - - response := &APIResponse{Response: r} - return response -} - -// NewAPIResponseWithError returns a new APIResponse object with the provided error message. -func NewAPIResponseWithError(errorMessage string) *APIResponse { - - response := &APIResponse{Message: errorMessage} - return response -} diff --git a/.schema/openapi/templates/go/signing.mustache b/.schema/openapi/templates/go/signing.mustache deleted file mode 100644 index 6202dea1d4f0..000000000000 --- a/.schema/openapi/templates/go/signing.mustache +++ /dev/null @@ -1,414 +0,0 @@ -{{>partial_header}} -package {{packageName}} - -import ( - "bytes" - "context" - "crypto" - "crypto/ecdsa" - "crypto/ed25519" - "crypto/rand" - "crypto/rsa" - "crypto/x509" - "encoding/base64" - "encoding/pem" - "fmt" - "io" - "net/http" - "net/textproto" - "os" - "strings" - "time" -) - -const ( - // Constants for HTTP signature parameters. - // The '(request-target)' parameter concatenates the lowercased :method, an - // ASCII space, and the :path pseudo-headers. - HttpSignatureParameterRequestTarget string = "(request-target)" - // The '(created)' parameter expresses when the signature was - // created. The value MUST be a Unix timestamp integer value. - HttpSignatureParameterCreated string = "(created)" - // The '(expires)' parameter expresses when the signature ceases to - // be valid. The value MUST be a Unix timestamp integer value. - HttpSignatureParameterExpires string = "(expires)" -) - -const ( - // Constants for HTTP headers. - // The 'Host' header, as defined in RFC 2616, section 14.23. - HttpHeaderHost string = "Host" - // The 'Date' header. - HttpHeaderDate string = "Date" - // The digest header, as defined in RFC 3230, section 4.3.2. - HttpHeaderDigest string = "Digest" - // The HTTP Authorization header, as defined in RFC 7235, section 4.2. - HttpHeaderAuthorization string = "Authorization" -) - -const ( - // Specifies the Digital Signature Algorithm is derived from metadata - // associated with 'keyId'. Supported DSA algorithms are RSASSA-PKCS1-v1_5, - // RSASSA-PSS, and ECDSA. - // The hash is SHA-512. - // This is the default value. - HttpSigningSchemeHs2019 string = "hs2019" - // Use RSASSA-PKCS1-v1_5 with SHA-512 hash. Deprecated. - HttpSigningSchemeRsaSha512 string = "rsa-sha512" - // Use RSASSA-PKCS1-v1_5 with SHA-256 hash. Deprecated. - HttpSigningSchemeRsaSha256 string = "rsa-sha256" - - // RFC 8017 section 7.2 - // Calculate the message signature using RSASSA-PKCS1-V1_5-SIGN from RSA PKCS#1 v1.5. - // PKCSV1_5 is deterministic. The same message and key will produce an identical - // signature value each time. - HttpSigningAlgorithmRsaPKCS1v15 string = "RSASSA-PKCS1-v1_5" - // Calculate the message signature using probabilistic signature scheme RSASSA-PSS. - // PSS is randomized and will produce a different signature value each time. - HttpSigningAlgorithmRsaPSS string = "RSASSA-PSS" -) - -var supportedSigningSchemes = map[string]bool{ - HttpSigningSchemeHs2019: true, - HttpSigningSchemeRsaSha512: true, - HttpSigningSchemeRsaSha256: true, -} - - -// HttpSignatureAuth provides HTTP signature authentication to a request passed -// via context using ContextHttpSignatureAuth. -// An 'Authorization' header is calculated by creating a hash of select headers, -// and optionally the body of the HTTP request, then signing the hash value using -// a private key which is available to the client. -// -// SignedHeaders specifies the list of HTTP headers that are included when generating -// the message signature. -// The two special signature headers '(request-target)' and '(created)' SHOULD be -// included in SignedHeaders. -// The '(created)' header expresses when the signature was created. -// The '(request-target)' header is a concatenation of the lowercased :method, an -// ASCII space, and the :path pseudo-headers. -// -// For example, SignedHeaders can be set to: -// (request-target) (created) date host digest -// -// When SignedHeaders is not specified, the client defaults to a single value, '(created)', -// in the list of HTTP headers. -// When SignedHeaders contains the 'Digest' value, the client performs the following operations: -// 1. Calculate a digest of request body, as specified in RFC3230, section 4.3.2. -// 2. Set the 'Digest' header in the request body. -// 3. Include the 'Digest' header and value in the HTTP signature. -type HttpSignatureAuth struct { - KeyId string // A key identifier. - PrivateKeyPath string // The path to the private key. - Passphrase string // The passphrase to decrypt the private key, if the key is encrypted. - SigningScheme string // The signature scheme, when signing HTTP requests. Supported value is 'hs2019'. - // The signature algorithm, when signing HTTP requests. - // Supported values are RSASSA-PKCS1-v1_5, RSASSA-PSS. - SigningAlgorithm string - SignedHeaders []string // A list of HTTP headers included when generating the signature for the message. - // SignatureMaxValidity specifies the maximum duration of the signature validity. - // The value is used to set the '(expires)' signature parameter in the HTTP request. - // '(expires)' is set to '(created)' plus the value of the SignatureMaxValidity field. - // To specify the '(expires)' signature parameter, set 'SignatureMaxValidity' and add '(expires)' to 'SignedHeaders'. - SignatureMaxValidity time.Duration - privateKey crypto.PrivateKey // The private key used to sign HTTP requests. -} - -// ContextWithValue validates the HttpSignatureAuth configuration parameters and returns a context -// suitable for HTTP signature. An error is returned if the HttpSignatureAuth configuration parameters -// are invalid. -func (h *HttpSignatureAuth) ContextWithValue(ctx context.Context) (context.Context, error) { - if h.KeyId == "" { - return nil, fmt.Errorf("Key ID must be specified") - } - if h.PrivateKeyPath == "" { - return nil, fmt.Errorf("Private key path must be specified") - } - if _, ok := supportedSigningSchemes[h.SigningScheme]; !ok { - return nil, fmt.Errorf("Invalid signing scheme: '%v'", h.SigningScheme) - } - m := make(map[string]bool) - for _, h := range h.SignedHeaders { - if strings.ToLower(h) == strings.ToLower(HttpHeaderAuthorization) { - return nil, fmt.Errorf("Signed headers cannot include the 'Authorization' header") - } - m[h] = true - } - if len(m) != len(h.SignedHeaders) { - return nil, fmt.Errorf("List of signed headers cannot have duplicate names") - } - if h.SignatureMaxValidity < 0 { - return nil, fmt.Errorf("Signature max validity must be a positive value") - } - if err := h.loadPrivateKey(); err != nil { - return nil, err - } - return context.WithValue(ctx, ContextHttpSignatureAuth, *h), nil -} - -// GetPublicKey returns the public key associated with this HTTP signature configuration. -func (h *HttpSignatureAuth) GetPublicKey() (crypto.PublicKey, error) { - if h.privateKey == nil { - if err := h.loadPrivateKey(); err != nil { - return nil, err - } - } - switch key := h.privateKey.(type) { - case *rsa.PrivateKey: - return key.Public(), nil - case *ecdsa.PrivateKey: - return key.Public(), nil - default: - // Do not change '%T' to anything else such as '%v'! - // The value of the private key must not be returned. - return nil, fmt.Errorf("Unsupported key: %T", h.privateKey) - } -} - -// loadPrivateKey reads the private key from the file specified in the HttpSignatureAuth. -func (h *HttpSignatureAuth) loadPrivateKey() (err error) { - var file *os.File - file, err = os.Open(h.PrivateKeyPath) - if err != nil { - return fmt.Errorf("Cannot load private key '%s'. Error: %v", h.PrivateKeyPath, err) - } - defer func() { - err = file.Close() - }() - var priv []byte - priv, err = io.ReadAll(file) - if err != nil { - return err - } - pemBlock, _ := pem.Decode(priv) - if pemBlock == nil { - // No PEM data has been found. - return fmt.Errorf("File '%s' does not contain PEM data", h.PrivateKeyPath) - } - var privKey []byte - if x509.IsEncryptedPEMBlock(pemBlock) { - // The PEM data is encrypted. - privKey, err = x509.DecryptPEMBlock(pemBlock, []byte(h.Passphrase)) - if err != nil { - // Failed to decrypt PEM block. Because of deficiencies in the encrypted-PEM format, - // it's not always possibleto detect an incorrect password. - return err - } - } else { - privKey = pemBlock.Bytes - } - switch pemBlock.Type { - case "RSA PRIVATE KEY": - if h.privateKey, err = x509.ParsePKCS1PrivateKey(privKey); err != nil { - return err - } - case "EC PRIVATE KEY", "PRIVATE KEY": - // https://tools.ietf.org/html/rfc5915 section 4. - if h.privateKey, err = x509.ParsePKCS8PrivateKey(privKey); err != nil { - return err - } - default: - return fmt.Errorf("Key '%s' is not supported", pemBlock.Type) - } - return nil -} - -// SignRequest signs the request using HTTP signature. -// See https://datatracker.ietf.org/doc/draft-cavage-http-signatures/ -// -// Do not add, remove or change headers that are included in the SignedHeaders -// after SignRequest has been invoked; this is because the header values are -// included in the signature. Any subsequent alteration will cause a signature -// verification failure. -// If there are multiple instances of the same header field, all -// header field values associated with the header field MUST be -// concatenated, separated by a ASCII comma and an ASCII space -// ', ', and used in the order in which they will appear in the -// transmitted HTTP message. -func SignRequest( - ctx context.Context, - r *http.Request, - auth HttpSignatureAuth) error { - - if auth.privateKey == nil { - return fmt.Errorf("Private key is not set") - } - now := time.Now() - date := now.UTC().Format(http.TimeFormat) - // The 'created' field expresses when the signature was created. - // The value MUST be a Unix timestamp integer value. See 'HTTP signature' section 2.1.4. - created := now.Unix() - - var h crypto.Hash - var err error - var prefix string - var expiresUnix float64 - - if auth.SignatureMaxValidity < 0 { - return fmt.Errorf("Signature validity must be a positive value") - } - if auth.SignatureMaxValidity > 0 { - e := now.Add(auth.SignatureMaxValidity) - expiresUnix = float64(e.Unix()) + float64(e.Nanosecond()) / float64(time.Second) - } - // Determine the cryptographic hash to be used for the signature and the body digest. - switch auth.SigningScheme { - case HttpSigningSchemeRsaSha512, HttpSigningSchemeHs2019: - h = crypto.SHA512 - prefix = "SHA-512=" - case HttpSigningSchemeRsaSha256: - // This is deprecated and should no longer be used. - h = crypto.SHA256 - prefix = "SHA-256=" - default: - return fmt.Errorf("Unsupported signature scheme: %v", auth.SigningScheme) - } - if !h.Available() { - return fmt.Errorf("Hash '%v' is not available", h) - } - - // Build the "(request-target)" signature header. - var sb bytes.Buffer - fmt.Fprintf(&sb, "%s %s", strings.ToLower(r.Method), r.URL.EscapedPath()) - if r.URL.RawQuery != "" { - // The ":path" pseudo-header field includes the path and query parts - // of the target URI (the "path-absolute" production and optionally a - // '?' character followed by the "query" production (see Sections 3.3 - // and 3.4 of [RFC3986] - fmt.Fprintf(&sb, "?%s", r.URL.RawQuery) - } - requestTarget := sb.String() - sb.Reset() - - // Build the string to be signed. - signedHeaders := auth.SignedHeaders - if len(signedHeaders) == 0 { - signedHeaders = []string{HttpSignatureParameterCreated} - } - // Validate the list of signed headers has no duplicates. - m := make(map[string]bool) - for _, h := range signedHeaders { - m[h] = true - } - if len(m) != len(signedHeaders) { - return fmt.Errorf("List of signed headers must not have any duplicates") - } - hasCreatedParameter := false - hasExpiresParameter := false - for i, header := range signedHeaders { - header = strings.ToLower(header) - var value string - switch header { - case strings.ToLower(HttpHeaderAuthorization): - return fmt.Errorf("Cannot include the 'Authorization' header as a signed header.") - case HttpSignatureParameterRequestTarget: - value = requestTarget - case HttpSignatureParameterCreated: - value = fmt.Sprintf("%d", created) - hasCreatedParameter = true - case HttpSignatureParameterExpires: - if auth.SignatureMaxValidity.Nanoseconds() == 0 { - return fmt.Errorf("Cannot set '(expires)' signature parameter. SignatureMaxValidity is not configured.") - } - value = fmt.Sprintf("%.3f", expiresUnix) - hasExpiresParameter = true - case "date": - value = date - r.Header.Set(HttpHeaderDate, date) - case "digest": - // Calculate the digest of the HTTP request body. - // Calculate body digest per RFC 3230 section 4.3.2 - bodyHash := h.New() - if r.Body != nil { - // Make a copy of the body io.Reader so that we can read the body to calculate the hash, - // then one more time when marshaling the request. - var body io.Reader - body, err = r.GetBody() - if err != nil { - return err - } - if _, err = io.Copy(bodyHash, body); err != nil { - return err - } - } - d := bodyHash.Sum(nil) - value = prefix + base64.StdEncoding.EncodeToString(d) - r.Header.Set(HttpHeaderDigest, value) - case "host": - value = r.Host - r.Header.Set(HttpHeaderHost, r.Host) - default: - var ok bool - var v []string - canonicalHeader := textproto.CanonicalMIMEHeaderKey(header) - if v, ok = r.Header[canonicalHeader]; !ok { - // If a header specified in the headers parameter cannot be matched with - // a provided header in the message, the implementation MUST produce an error. - return fmt.Errorf("Header '%s' does not exist in the request", canonicalHeader) - } - // If there are multiple instances of the same header field, all - // header field values associated with the header field MUST be - // concatenated, separated by a ASCII comma and an ASCII space - // `, `, and used in the order in which they will appear in the - // transmitted HTTP message. - value = strings.Join(v, ", ") - } - if i > 0 { - fmt.Fprintf(&sb, "\n") - } - fmt.Fprintf(&sb, "%s: %s", header, value) - } - if expiresUnix != 0 && !hasExpiresParameter { - return fmt.Errorf("SignatureMaxValidity is specified, but '(expired)' parameter is not present") - } - msg := []byte(sb.String()) - msgHash := h.New() - if _, err = msgHash.Write(msg); err != nil { - return err - } - d := msgHash.Sum(nil) - - var signature []byte - switch key := auth.privateKey.(type) { - case *rsa.PrivateKey: - switch auth.SigningAlgorithm { - case HttpSigningAlgorithmRsaPKCS1v15: - signature, err = rsa.SignPKCS1v15(rand.Reader, key, h, d) - case "", HttpSigningAlgorithmRsaPSS: - signature, err = rsa.SignPSS(rand.Reader, key, h, d, nil) - default: - return fmt.Errorf("Unsupported signing algorithm: '%s'", auth.SigningAlgorithm) - } - case *ecdsa.PrivateKey: - signature, err = key.Sign(rand.Reader, d, h) - case ed25519.PrivateKey: // requires go 1.13 - signature, err = key.Sign(rand.Reader, msg, crypto.Hash(0)) - default: - return fmt.Errorf("Unsupported private key") - } - if err != nil { - return err - } - - sb.Reset() - for i, header := range signedHeaders { - if i > 0 { - sb.WriteRune(' ') - } - sb.WriteString(strings.ToLower(header)) - } - headers_list := sb.String() - sb.Reset() - fmt.Fprintf(&sb, `Signature keyId="%s",algorithm="%s",`, auth.KeyId, auth.SigningScheme) - if hasCreatedParameter { - fmt.Fprintf(&sb, "created=%d,", created) - } - if hasExpiresParameter { - fmt.Fprintf(&sb, "expires=%.3f,", expiresUnix) - } - fmt.Fprintf(&sb, `headers="%s",signature="%s"`, headers_list, base64.StdEncoding.EncodeToString(signature)) - authStr := sb.String() - r.Header.Set(HttpHeaderAuthorization, authStr) - return nil -} diff --git a/.schema/openapi/templates/go/utils.mustache b/.schema/openapi/templates/go/utils.mustache deleted file mode 100644 index fed52d7059eb..000000000000 --- a/.schema/openapi/templates/go/utils.mustache +++ /dev/null @@ -1,326 +0,0 @@ -{{>partial_header}} -package {{packageName}} - -import ( - "encoding/json" - "time" -) - -// PtrBool is a helper routine that returns a pointer to given boolean value. -func PtrBool(v bool) *bool { return &v } - -// PtrInt is a helper routine that returns a pointer to given integer value. -func PtrInt(v int) *int { return &v } - -// PtrInt32 is a helper routine that returns a pointer to given integer value. -func PtrInt32(v int32) *int32 { return &v } - -// PtrInt64 is a helper routine that returns a pointer to given integer value. -func PtrInt64(v int64) *int64 { return &v } - -// PtrFloat32 is a helper routine that returns a pointer to given float value. -func PtrFloat32(v float32) *float32 { return &v } - -// PtrFloat64 is a helper routine that returns a pointer to given float value. -func PtrFloat64(v float64) *float64 { return &v } - -// PtrString is a helper routine that returns a pointer to given string value. -func PtrString(v string) *string { return &v } - -// PtrTime is helper routine that returns a pointer to given Time value. -func PtrTime(v time.Time) *time.Time { return &v } - -type NullableBool struct { - value *bool - isSet bool -} - -func (v NullableBool) Get() *bool { - return v.value -} - -func (v *NullableBool) Set(val *bool) { - v.value = val - v.isSet = true -} - -func (v NullableBool) IsSet() bool { - return v.isSet -} - -func (v *NullableBool) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableBool(val *bool) *NullableBool { - return &NullableBool{value: val, isSet: true} -} - -func (v NullableBool) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableBool) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - - -type NullableInt struct { - value *int - isSet bool -} - -func (v NullableInt) Get() *int { - return v.value -} - -func (v *NullableInt) Set(val *int) { - v.value = val - v.isSet = true -} - -func (v NullableInt) IsSet() bool { - return v.isSet -} - -func (v *NullableInt) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInt(val *int) *NullableInt { - return &NullableInt{value: val, isSet: true} -} - -func (v NullableInt) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInt) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - - -type NullableInt32 struct { - value *int32 - isSet bool -} - -func (v NullableInt32) Get() *int32 { - return v.value -} - -func (v *NullableInt32) Set(val *int32) { - v.value = val - v.isSet = true -} - -func (v NullableInt32) IsSet() bool { - return v.isSet -} - -func (v *NullableInt32) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInt32(val *int32) *NullableInt32 { - return &NullableInt32{value: val, isSet: true} -} - -func (v NullableInt32) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInt32) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - - -type NullableInt64 struct { - value *int64 - isSet bool -} - -func (v NullableInt64) Get() *int64 { - return v.value -} - -func (v *NullableInt64) Set(val *int64) { - v.value = val - v.isSet = true -} - -func (v NullableInt64) IsSet() bool { - return v.isSet -} - -func (v *NullableInt64) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInt64(val *int64) *NullableInt64 { - return &NullableInt64{value: val, isSet: true} -} - -func (v NullableInt64) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInt64) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - - -type NullableFloat32 struct { - value *float32 - isSet bool -} - -func (v NullableFloat32) Get() *float32 { - return v.value -} - -func (v *NullableFloat32) Set(val *float32) { - v.value = val - v.isSet = true -} - -func (v NullableFloat32) IsSet() bool { - return v.isSet -} - -func (v *NullableFloat32) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableFloat32(val *float32) *NullableFloat32 { - return &NullableFloat32{value: val, isSet: true} -} - -func (v NullableFloat32) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableFloat32) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - - -type NullableFloat64 struct { - value *float64 - isSet bool -} - -func (v NullableFloat64) Get() *float64 { - return v.value -} - -func (v *NullableFloat64) Set(val *float64) { - v.value = val - v.isSet = true -} - -func (v NullableFloat64) IsSet() bool { - return v.isSet -} - -func (v *NullableFloat64) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableFloat64(val *float64) *NullableFloat64 { - return &NullableFloat64{value: val, isSet: true} -} - -func (v NullableFloat64) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableFloat64) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - - -type NullableString struct { - value *string - isSet bool -} - -func (v NullableString) Get() *string { - return v.value -} - -func (v *NullableString) Set(val *string) { - v.value = val - v.isSet = true -} - -func (v NullableString) IsSet() bool { - return v.isSet -} - -func (v *NullableString) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableString(val *string) *NullableString { - return &NullableString{value: val, isSet: true} -} - -func (v NullableString) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableString) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - - -type NullableTime struct { - value *time.Time - isSet bool -} - -func (v NullableTime) Get() *time.Time { - return v.value -} - -func (v *NullableTime) Set(val *time.Time) { - v.value = val - v.isSet = true -} - -func (v NullableTime) IsSet() bool { - return v.isSet -} - -func (v *NullableTime) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTime(val *time.Time) *NullableTime { - return &NullableTime{value: val, isSet: true} -} - -func (v NullableTime) MarshalJSON() ([]byte, error) { - return v.value.MarshalJSON() -} - -func (v *NullableTime) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/Makefile b/Makefile index 1775d09b25ea..1b45eb7cfeb4 100644 --- a/Makefile +++ b/Makefile @@ -126,7 +126,6 @@ sdk: .bin/swagger .bin/ory node_modules --git-repo-id client-go \ --git-host github.com \ --api-name-suffix "Api" \ - -t .schema/openapi/templates/go \ -c .schema/openapi/gen.go.yml (cd internal/httpclient; rm -rf go.mod go.sum test api docs) @@ -140,7 +139,6 @@ sdk: .bin/swagger .bin/ory node_modules --git-repo-id client-go \ --git-host github.com \ --api-name-suffix "Api" \ - -t .schema/openapi/templates/go \ -c .schema/openapi/gen.go.yml (cd internal/client-go; go mod edit -module github.com/ory/client-go go.mod; rm -rf test api docs) diff --git a/internal/client-go/README.md b/internal/client-go/README.md index 7f5de7166ef1..78b841a050ff 100644 --- a/internal/client-go/README.md +++ b/internal/client-go/README.md @@ -14,21 +14,20 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat Install the following dependencies: -```shell +```sh go get github.com/stretchr/testify/assert -go get golang.org/x/oauth2 go get golang.org/x/net/context ``` Put the package under your project folder and add the following in import: -```golang +```go import client "github.com/ory/client-go" ``` To use a proxy, set the environment variable `HTTP_PROXY`: -```golang +```go os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") ``` @@ -38,17 +37,17 @@ Default configuration comes with `Servers` field that contains server objects as ### Select Server Configuration -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. +For using other server than the one defined on index 0 set context value `client.ContextServerIndex` of type `int`. -```golang +```go ctx := context.WithValue(context.Background(), client.ContextServerIndex, 1) ``` ### Templated Server URL -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. +Templated server URL is formatted using default variables from configuration or from context value `client.ContextServerVariables` of type `map[string]string`. -```golang +```go ctx := context.WithValue(context.Background(), client.ContextServerVariables, map[string]string{ "basePath": "v2", }) @@ -59,10 +58,10 @@ Note, enum values are always validated and all unused variables are silently ign ### URLs Configuration per Operation Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. -An operation is uniquely identifield by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `client.ContextOperationServerIndices` and `client.ContextOperationServerVariables` context maps. -``` +```go ctx := context.WithValue(context.Background(), client.ContextOperationServerIndices, map[string]int{ "{classname}Service.{nickname}": 2, }) @@ -254,7 +253,7 @@ Class | Method | HTTP request | Description ## Documentation For Authorization - +Authentication schemes defined for the API: ### oryAccessToken - **Type**: API key @@ -263,6 +262,19 @@ Class | Method | HTTP request | Description Note, each API key must be added to a map of `map[string]APIKey` where the key is: Authorization and passed in as the auth context for each request. +Example + +```go +auth := context.WithValue( + context.Background(), + client.ContextAPIKeys, + map[string]client.APIKey{ + "Authorization": {Key: "API_KEY_STRING"}, + }, + ) +r, err := client.Service.Operation(auth, args) +``` + ## Documentation for Utility Methods diff --git a/internal/client-go/api_courier.go b/internal/client-go/api_courier.go index a7e43bcd183e..24ffc8fb1bc9 100644 --- a/internal/client-go/api_courier.go +++ b/internal/client-go/api_courier.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -20,83 +20,77 @@ import ( "strings" ) -// Linger please -var ( - _ context.Context -) - type CourierApi interface { /* - * GetCourierMessage Get a Message - * Gets a specific messages by the given ID. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id MessageID is the ID of the message. - * @return CourierApiApiGetCourierMessageRequest - */ - GetCourierMessage(ctx context.Context, id string) CourierApiApiGetCourierMessageRequest + GetCourierMessage Get a Message - /* - * GetCourierMessageExecute executes the request - * @return Message - */ - GetCourierMessageExecute(r CourierApiApiGetCourierMessageRequest) (*Message, *http.Response, error) + Gets a specific messages by the given ID. - /* - * ListCourierMessages List Messages - * Lists all messages by given status and recipient. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return CourierApiApiListCourierMessagesRequest - */ - ListCourierMessages(ctx context.Context) CourierApiApiListCourierMessagesRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id MessageID is the ID of the message. + @return CourierApiGetCourierMessageRequest + */ + GetCourierMessage(ctx context.Context, id string) CourierApiGetCourierMessageRequest + + // GetCourierMessageExecute executes the request + // @return Message + GetCourierMessageExecute(r CourierApiGetCourierMessageRequest) (*Message, *http.Response, error) /* - * ListCourierMessagesExecute executes the request - * @return []Message - */ - ListCourierMessagesExecute(r CourierApiApiListCourierMessagesRequest) ([]Message, *http.Response, error) + ListCourierMessages List Messages + + Lists all messages by given status and recipient. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return CourierApiListCourierMessagesRequest + */ + ListCourierMessages(ctx context.Context) CourierApiListCourierMessagesRequest + + // ListCourierMessagesExecute executes the request + // @return []Message + ListCourierMessagesExecute(r CourierApiListCourierMessagesRequest) ([]Message, *http.Response, error) } // CourierApiService CourierApi service type CourierApiService service -type CourierApiApiGetCourierMessageRequest struct { +type CourierApiGetCourierMessageRequest struct { ctx context.Context ApiService CourierApi id string } -func (r CourierApiApiGetCourierMessageRequest) Execute() (*Message, *http.Response, error) { +func (r CourierApiGetCourierMessageRequest) Execute() (*Message, *http.Response, error) { return r.ApiService.GetCourierMessageExecute(r) } /* - * GetCourierMessage Get a Message - * Gets a specific messages by the given ID. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id MessageID is the ID of the message. - * @return CourierApiApiGetCourierMessageRequest - */ -func (a *CourierApiService) GetCourierMessage(ctx context.Context, id string) CourierApiApiGetCourierMessageRequest { - return CourierApiApiGetCourierMessageRequest{ +GetCourierMessage Get a Message + +Gets a specific messages by the given ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id MessageID is the ID of the message. + @return CourierApiGetCourierMessageRequest +*/ +func (a *CourierApiService) GetCourierMessage(ctx context.Context, id string) CourierApiGetCourierMessageRequest { + return CourierApiGetCourierMessageRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return Message - */ -func (a *CourierApiService) GetCourierMessageExecute(r CourierApiApiGetCourierMessageRequest) (*Message, *http.Response, error) { +// Execute executes the request +// +// @return Message +func (a *CourierApiService) GetCourierMessageExecute(r CourierApiGetCourierMessageRequest) (*Message, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Message + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Message ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CourierApiService.GetCourierMessage") @@ -105,7 +99,7 @@ func (a *CourierApiService) GetCourierMessageExecute(r CourierApiApiGetCourierMe } localVarPath := localBasePath + "/admin/courier/messages/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -142,7 +136,7 @@ func (a *CourierApiService) GetCourierMessageExecute(r CourierApiApiGetCourierMe } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -171,6 +165,7 @@ func (a *CourierApiService) GetCourierMessageExecute(r CourierApiApiGetCourierMe newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -180,6 +175,7 @@ func (a *CourierApiService) GetCourierMessageExecute(r CourierApiApiGetCourierMe newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -196,7 +192,7 @@ func (a *CourierApiService) GetCourierMessageExecute(r CourierApiApiGetCourierMe return localVarReturnValue, localVarHTTPResponse, nil } -type CourierApiApiListCourierMessagesRequest struct { +type CourierApiListCourierMessagesRequest struct { ctx context.Context ApiService CourierApi pageSize *int64 @@ -205,52 +201,58 @@ type CourierApiApiListCourierMessagesRequest struct { recipient *string } -func (r CourierApiApiListCourierMessagesRequest) PageSize(pageSize int64) CourierApiApiListCourierMessagesRequest { +// Items per Page This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r CourierApiListCourierMessagesRequest) PageSize(pageSize int64) CourierApiListCourierMessagesRequest { r.pageSize = &pageSize return r } -func (r CourierApiApiListCourierMessagesRequest) PageToken(pageToken string) CourierApiApiListCourierMessagesRequest { + +// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r CourierApiListCourierMessagesRequest) PageToken(pageToken string) CourierApiListCourierMessagesRequest { r.pageToken = &pageToken return r } -func (r CourierApiApiListCourierMessagesRequest) Status(status CourierMessageStatus) CourierApiApiListCourierMessagesRequest { + +// Status filters out messages based on status. If no value is provided, it doesn't take effect on filter. +func (r CourierApiListCourierMessagesRequest) Status(status CourierMessageStatus) CourierApiListCourierMessagesRequest { r.status = &status return r } -func (r CourierApiApiListCourierMessagesRequest) Recipient(recipient string) CourierApiApiListCourierMessagesRequest { + +// Recipient filters out messages based on recipient. If no value is provided, it doesn't take effect on filter. +func (r CourierApiListCourierMessagesRequest) Recipient(recipient string) CourierApiListCourierMessagesRequest { r.recipient = &recipient return r } -func (r CourierApiApiListCourierMessagesRequest) Execute() ([]Message, *http.Response, error) { +func (r CourierApiListCourierMessagesRequest) Execute() ([]Message, *http.Response, error) { return r.ApiService.ListCourierMessagesExecute(r) } /* - * ListCourierMessages List Messages - * Lists all messages by given status and recipient. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return CourierApiApiListCourierMessagesRequest - */ -func (a *CourierApiService) ListCourierMessages(ctx context.Context) CourierApiApiListCourierMessagesRequest { - return CourierApiApiListCourierMessagesRequest{ +ListCourierMessages List Messages + +Lists all messages by given status and recipient. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return CourierApiListCourierMessagesRequest +*/ +func (a *CourierApiService) ListCourierMessages(ctx context.Context) CourierApiListCourierMessagesRequest { + return CourierApiListCourierMessagesRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return []Message - */ -func (a *CourierApiService) ListCourierMessagesExecute(r CourierApiApiListCourierMessagesRequest) ([]Message, *http.Response, error) { +// Execute executes the request +// +// @return []Message +func (a *CourierApiService) ListCourierMessagesExecute(r CourierApiListCourierMessagesRequest) ([]Message, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []Message + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Message ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CourierApiService.ListCourierMessages") @@ -265,16 +267,19 @@ func (a *CourierApiService) ListCourierMessagesExecute(r CourierApiApiListCourie localVarFormParams := url.Values{} if r.pageSize != nil { - localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "") + } else { + var defaultValue int64 = 250 + r.pageSize = &defaultValue } if r.pageToken != nil { - localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "") } if r.status != nil { - localVarQueryParams.Add("status", parameterToString(*r.status, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "status", r.status, "") } if r.recipient != nil { - localVarQueryParams.Add("recipient", parameterToString(*r.recipient, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "recipient", r.recipient, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -307,7 +312,7 @@ func (a *CourierApiService) ListCourierMessagesExecute(r CourierApiApiListCourie } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -336,6 +341,7 @@ func (a *CourierApiService) ListCourierMessagesExecute(r CourierApiApiListCourie newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -345,6 +351,7 @@ func (a *CourierApiService) ListCourierMessagesExecute(r CourierApiApiListCourie newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/internal/client-go/api_frontend.go b/internal/client-go/api_frontend.go index 94c0d05a6dba..b03b4003f07a 100644 --- a/internal/client-go/api_frontend.go +++ b/internal/client-go/api_frontend.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -20,16 +20,12 @@ import ( "strings" ) -// Linger please -var ( - _ context.Context -) - type FrontendApi interface { /* - * CreateBrowserLoginFlow Create Login Flow for Browsers - * This endpoint initializes a browser-based user login flow. This endpoint will set the appropriate + CreateBrowserLoginFlow Create Login Flow for Browsers + + This endpoint initializes a browser-based user login flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. If this endpoint is opened as a link in the browser, it will be redirected to @@ -52,20 +48,20 @@ type FrontendApi interface { This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateBrowserLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserLoginFlowRequest */ - CreateBrowserLoginFlow(ctx context.Context) FrontendApiApiCreateBrowserLoginFlowRequest + CreateBrowserLoginFlow(ctx context.Context) FrontendApiCreateBrowserLoginFlowRequest - /* - * CreateBrowserLoginFlowExecute executes the request - * @return LoginFlow - */ - CreateBrowserLoginFlowExecute(r FrontendApiApiCreateBrowserLoginFlowRequest) (*LoginFlow, *http.Response, error) + // CreateBrowserLoginFlowExecute executes the request + // @return LoginFlow + CreateBrowserLoginFlowExecute(r FrontendApiCreateBrowserLoginFlowRequest) (*LoginFlow, *http.Response, error) /* - * CreateBrowserLogoutFlow Create a Logout URL for Browsers - * This endpoint initializes a browser-based user logout flow and a URL which can be used to log out the user. + CreateBrowserLogoutFlow Create a Logout URL for Browsers + + This endpoint initializes a browser-based user logout flow and a URL which can be used to log out the user. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). For API clients you can @@ -75,20 +71,20 @@ type FrontendApi interface { a 401 error. When calling this endpoint from a backend, please ensure to properly forward the HTTP cookies. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateBrowserLogoutFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserLogoutFlowRequest */ - CreateBrowserLogoutFlow(ctx context.Context) FrontendApiApiCreateBrowserLogoutFlowRequest + CreateBrowserLogoutFlow(ctx context.Context) FrontendApiCreateBrowserLogoutFlowRequest - /* - * CreateBrowserLogoutFlowExecute executes the request - * @return LogoutFlow - */ - CreateBrowserLogoutFlowExecute(r FrontendApiApiCreateBrowserLogoutFlowRequest) (*LogoutFlow, *http.Response, error) + // CreateBrowserLogoutFlowExecute executes the request + // @return LogoutFlow + CreateBrowserLogoutFlowExecute(r FrontendApiCreateBrowserLogoutFlowRequest) (*LogoutFlow, *http.Response, error) /* - * CreateBrowserRecoveryFlow Create Recovery Flow for Browsers - * This endpoint initializes a browser-based account recovery flow. Once initialized, the browser will be redirected to + CreateBrowserRecoveryFlow Create Recovery Flow for Browsers + + This endpoint initializes a browser-based account recovery flow. Once initialized, the browser will be redirected to `selfservice.flows.recovery.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists, the browser is returned to the configured return URL. @@ -98,20 +94,20 @@ type FrontendApi interface { This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateBrowserRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserRecoveryFlowRequest */ - CreateBrowserRecoveryFlow(ctx context.Context) FrontendApiApiCreateBrowserRecoveryFlowRequest + CreateBrowserRecoveryFlow(ctx context.Context) FrontendApiCreateBrowserRecoveryFlowRequest - /* - * CreateBrowserRecoveryFlowExecute executes the request - * @return RecoveryFlow - */ - CreateBrowserRecoveryFlowExecute(r FrontendApiApiCreateBrowserRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) + // CreateBrowserRecoveryFlowExecute executes the request + // @return RecoveryFlow + CreateBrowserRecoveryFlowExecute(r FrontendApiCreateBrowserRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) /* - * CreateBrowserRegistrationFlow Create Registration Flow for Browsers - * This endpoint initializes a browser-based user registration flow. This endpoint will set the appropriate + CreateBrowserRegistrationFlow Create Registration Flow for Browsers + + This endpoint initializes a browser-based user registration flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. If this endpoint is opened as a link in the browser, it will be redirected to @@ -130,20 +126,20 @@ type FrontendApi interface { This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateBrowserRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserRegistrationFlowRequest */ - CreateBrowserRegistrationFlow(ctx context.Context) FrontendApiApiCreateBrowserRegistrationFlowRequest + CreateBrowserRegistrationFlow(ctx context.Context) FrontendApiCreateBrowserRegistrationFlowRequest - /* - * CreateBrowserRegistrationFlowExecute executes the request - * @return RegistrationFlow - */ - CreateBrowserRegistrationFlowExecute(r FrontendApiApiCreateBrowserRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) + // CreateBrowserRegistrationFlowExecute executes the request + // @return RegistrationFlow + CreateBrowserRegistrationFlowExecute(r FrontendApiCreateBrowserRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) /* - * CreateBrowserSettingsFlow Create Settings Flow for Browsers - * This endpoint initializes a browser-based user settings flow. Once initialized, the browser will be redirected to + CreateBrowserSettingsFlow Create Settings Flow for Browsers + + This endpoint initializes a browser-based user settings flow. Once initialized, the browser will be redirected to `selfservice.flows.settings.ui_url` with the flow ID set as the query parameter `?flow=`. If no valid Ory Kratos Session Cookie is included in the request, a login flow will be initialized. @@ -169,20 +165,20 @@ type FrontendApi interface { This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateBrowserSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserSettingsFlowRequest */ - CreateBrowserSettingsFlow(ctx context.Context) FrontendApiApiCreateBrowserSettingsFlowRequest + CreateBrowserSettingsFlow(ctx context.Context) FrontendApiCreateBrowserSettingsFlowRequest - /* - * CreateBrowserSettingsFlowExecute executes the request - * @return SettingsFlow - */ - CreateBrowserSettingsFlowExecute(r FrontendApiApiCreateBrowserSettingsFlowRequest) (*SettingsFlow, *http.Response, error) + // CreateBrowserSettingsFlowExecute executes the request + // @return SettingsFlow + CreateBrowserSettingsFlowExecute(r FrontendApiCreateBrowserSettingsFlowRequest) (*SettingsFlow, *http.Response, error) /* - * CreateBrowserVerificationFlow Create Verification Flow for Browser Clients - * This endpoint initializes a browser-based account verification flow. Once initialized, the browser will be redirected to + CreateBrowserVerificationFlow Create Verification Flow for Browser Clients + + This endpoint initializes a browser-based account verification flow. Once initialized, the browser will be redirected to `selfservice.flows.verification.ui_url` with the flow ID set as the query parameter `?flow=`. If this endpoint is called via an AJAX request, the response contains the recovery flow without any redirects. @@ -190,20 +186,20 @@ type FrontendApi interface { This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateBrowserVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserVerificationFlowRequest */ - CreateBrowserVerificationFlow(ctx context.Context) FrontendApiApiCreateBrowserVerificationFlowRequest + CreateBrowserVerificationFlow(ctx context.Context) FrontendApiCreateBrowserVerificationFlowRequest - /* - * CreateBrowserVerificationFlowExecute executes the request - * @return VerificationFlow - */ - CreateBrowserVerificationFlowExecute(r FrontendApiApiCreateBrowserVerificationFlowRequest) (*VerificationFlow, *http.Response, error) + // CreateBrowserVerificationFlowExecute executes the request + // @return VerificationFlow + CreateBrowserVerificationFlowExecute(r FrontendApiCreateBrowserVerificationFlowRequest) (*VerificationFlow, *http.Response, error) /* - * CreateNativeLoginFlow Create Login Flow for Native Apps - * This endpoint initiates a login flow for native apps that do not use a browser, such as mobile devices, smart TVs, and so on. + CreateNativeLoginFlow Create Login Flow for Native Apps + + This endpoint initiates a login flow for native apps that do not use a browser, such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. @@ -223,20 +219,20 @@ type FrontendApi interface { This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateNativeLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeLoginFlowRequest */ - CreateNativeLoginFlow(ctx context.Context) FrontendApiApiCreateNativeLoginFlowRequest + CreateNativeLoginFlow(ctx context.Context) FrontendApiCreateNativeLoginFlowRequest - /* - * CreateNativeLoginFlowExecute executes the request - * @return LoginFlow - */ - CreateNativeLoginFlowExecute(r FrontendApiApiCreateNativeLoginFlowRequest) (*LoginFlow, *http.Response, error) + // CreateNativeLoginFlowExecute executes the request + // @return LoginFlow + CreateNativeLoginFlowExecute(r FrontendApiCreateNativeLoginFlowRequest) (*LoginFlow, *http.Response, error) /* - * CreateNativeRecoveryFlow Create Recovery Flow for Native Apps - * This endpoint initiates a recovery flow for API clients such as mobile devices, smart TVs, and so on. + CreateNativeRecoveryFlow Create Recovery Flow for Native Apps + + This endpoint initiates a recovery flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error. @@ -249,20 +245,20 @@ type FrontendApi interface { This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateNativeRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeRecoveryFlowRequest */ - CreateNativeRecoveryFlow(ctx context.Context) FrontendApiApiCreateNativeRecoveryFlowRequest + CreateNativeRecoveryFlow(ctx context.Context) FrontendApiCreateNativeRecoveryFlowRequest - /* - * CreateNativeRecoveryFlowExecute executes the request - * @return RecoveryFlow - */ - CreateNativeRecoveryFlowExecute(r FrontendApiApiCreateNativeRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) + // CreateNativeRecoveryFlowExecute executes the request + // @return RecoveryFlow + CreateNativeRecoveryFlowExecute(r FrontendApiCreateNativeRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) /* - * CreateNativeRegistrationFlow Create Registration Flow for Native Apps - * This endpoint initiates a registration flow for API clients such as mobile devices, smart TVs, and so on. + CreateNativeRegistrationFlow Create Registration Flow for Native Apps + + This endpoint initiates a registration flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. @@ -281,20 +277,20 @@ type FrontendApi interface { This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateNativeRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeRegistrationFlowRequest */ - CreateNativeRegistrationFlow(ctx context.Context) FrontendApiApiCreateNativeRegistrationFlowRequest + CreateNativeRegistrationFlow(ctx context.Context) FrontendApiCreateNativeRegistrationFlowRequest - /* - * CreateNativeRegistrationFlowExecute executes the request - * @return RegistrationFlow - */ - CreateNativeRegistrationFlowExecute(r FrontendApiApiCreateNativeRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) + // CreateNativeRegistrationFlowExecute executes the request + // @return RegistrationFlow + CreateNativeRegistrationFlowExecute(r FrontendApiCreateNativeRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) /* - * CreateNativeSettingsFlow Create Settings Flow for Native Apps - * This endpoint initiates a settings flow for API clients such as mobile devices, smart TVs, and so on. + CreateNativeSettingsFlow Create Settings Flow for Native Apps + + This endpoint initiates a settings flow for API clients such as mobile devices, smart TVs, and so on. You must provide a valid Ory Kratos Session Token for this endpoint to respond with HTTP 200 OK. To fetch an existing settings flow call `/self-service/settings/flows?flow=`. @@ -316,20 +312,20 @@ type FrontendApi interface { This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateNativeSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeSettingsFlowRequest */ - CreateNativeSettingsFlow(ctx context.Context) FrontendApiApiCreateNativeSettingsFlowRequest + CreateNativeSettingsFlow(ctx context.Context) FrontendApiCreateNativeSettingsFlowRequest - /* - * CreateNativeSettingsFlowExecute executes the request - * @return SettingsFlow - */ - CreateNativeSettingsFlowExecute(r FrontendApiApiCreateNativeSettingsFlowRequest) (*SettingsFlow, *http.Response, error) + // CreateNativeSettingsFlowExecute executes the request + // @return SettingsFlow + CreateNativeSettingsFlowExecute(r FrontendApiCreateNativeSettingsFlowRequest) (*SettingsFlow, *http.Response, error) /* - * CreateNativeVerificationFlow Create Verification Flow for Native Apps - * This endpoint initiates a verification flow for API clients such as mobile devices, smart TVs, and so on. + CreateNativeVerificationFlow Create Verification Flow for Native Apps + + This endpoint initiates a verification flow for API clients such as mobile devices, smart TVs, and so on. To fetch an existing verification flow call `/self-service/verification/flows?flow=`. @@ -340,83 +336,82 @@ type FrontendApi interface { This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateNativeVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeVerificationFlowRequest */ - CreateNativeVerificationFlow(ctx context.Context) FrontendApiApiCreateNativeVerificationFlowRequest + CreateNativeVerificationFlow(ctx context.Context) FrontendApiCreateNativeVerificationFlowRequest - /* - * CreateNativeVerificationFlowExecute executes the request - * @return VerificationFlow - */ - CreateNativeVerificationFlowExecute(r FrontendApiApiCreateNativeVerificationFlowRequest) (*VerificationFlow, *http.Response, error) + // CreateNativeVerificationFlowExecute executes the request + // @return VerificationFlow + CreateNativeVerificationFlowExecute(r FrontendApiCreateNativeVerificationFlowRequest) (*VerificationFlow, *http.Response, error) /* - * DisableMyOtherSessions Disable my other sessions - * Calling this endpoint invalidates all except the current session that belong to the logged-in user. + DisableMyOtherSessions Disable my other sessions + + Calling this endpoint invalidates all except the current session that belong to the logged-in user. Session data are not deleted. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiDisableMyOtherSessionsRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiDisableMyOtherSessionsRequest */ - DisableMyOtherSessions(ctx context.Context) FrontendApiApiDisableMyOtherSessionsRequest + DisableMyOtherSessions(ctx context.Context) FrontendApiDisableMyOtherSessionsRequest - /* - * DisableMyOtherSessionsExecute executes the request - * @return DeleteMySessionsCount - */ - DisableMyOtherSessionsExecute(r FrontendApiApiDisableMyOtherSessionsRequest) (*DeleteMySessionsCount, *http.Response, error) + // DisableMyOtherSessionsExecute executes the request + // @return DeleteMySessionsCount + DisableMyOtherSessionsExecute(r FrontendApiDisableMyOtherSessionsRequest) (*DeleteMySessionsCount, *http.Response, error) /* - * DisableMySession Disable one of my sessions - * Calling this endpoint invalidates the specified session. The current session cannot be revoked. + DisableMySession Disable one of my sessions + + Calling this endpoint invalidates the specified session. The current session cannot be revoked. Session data are not deleted. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the session's ID. - * @return FrontendApiApiDisableMySessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return FrontendApiDisableMySessionRequest */ - DisableMySession(ctx context.Context, id string) FrontendApiApiDisableMySessionRequest + DisableMySession(ctx context.Context, id string) FrontendApiDisableMySessionRequest - /* - * DisableMySessionExecute executes the request - */ - DisableMySessionExecute(r FrontendApiApiDisableMySessionRequest) (*http.Response, error) + // DisableMySessionExecute executes the request + DisableMySessionExecute(r FrontendApiDisableMySessionRequest) (*http.Response, error) /* - * ExchangeSessionToken Exchange Session Token - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiExchangeSessionTokenRequest - */ - ExchangeSessionToken(ctx context.Context) FrontendApiApiExchangeSessionTokenRequest + ExchangeSessionToken Exchange Session Token - /* - * ExchangeSessionTokenExecute executes the request - * @return SuccessfulNativeLogin - */ - ExchangeSessionTokenExecute(r FrontendApiApiExchangeSessionTokenRequest) (*SuccessfulNativeLogin, *http.Response, error) + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiExchangeSessionTokenRequest + */ + ExchangeSessionToken(ctx context.Context) FrontendApiExchangeSessionTokenRequest + + // ExchangeSessionTokenExecute executes the request + // @return SuccessfulNativeLogin + ExchangeSessionTokenExecute(r FrontendApiExchangeSessionTokenRequest) (*SuccessfulNativeLogin, *http.Response, error) /* - * GetFlowError Get User-Flow Errors - * This endpoint returns the error associated with a user-facing self service errors. + GetFlowError Get User-Flow Errors + + This endpoint returns the error associated with a user-facing self service errors. This endpoint supports stub values to help you implement the error UI: `?id=stub:500` - returns a stub 500 (Internal Server Error) error. More information can be found at [Ory Kratos User User Facing Error Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-facing-errors). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetFlowErrorRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetFlowErrorRequest */ - GetFlowError(ctx context.Context) FrontendApiApiGetFlowErrorRequest + GetFlowError(ctx context.Context) FrontendApiGetFlowErrorRequest - /* - * GetFlowErrorExecute executes the request - * @return FlowError - */ - GetFlowErrorExecute(r FrontendApiApiGetFlowErrorRequest) (*FlowError, *http.Response, error) + // GetFlowErrorExecute executes the request + // @return FlowError + GetFlowErrorExecute(r FrontendApiGetFlowErrorRequest) (*FlowError, *http.Response, error) /* - * GetLoginFlow Get Login Flow - * This endpoint returns a login flow's context with, for example, error details and other information. + GetLoginFlow Get Login Flow + + This endpoint returns a login flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -439,20 +434,20 @@ type FrontendApi interface { `self_service_flow_expired`: The flow is expired and you should request a new one. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetLoginFlowRequest */ - GetLoginFlow(ctx context.Context) FrontendApiApiGetLoginFlowRequest + GetLoginFlow(ctx context.Context) FrontendApiGetLoginFlowRequest - /* - * GetLoginFlowExecute executes the request - * @return LoginFlow - */ - GetLoginFlowExecute(r FrontendApiApiGetLoginFlowRequest) (*LoginFlow, *http.Response, error) + // GetLoginFlowExecute executes the request + // @return LoginFlow + GetLoginFlowExecute(r FrontendApiGetLoginFlowRequest) (*LoginFlow, *http.Response, error) /* - * GetRecoveryFlow Get Recovery Flow - * This endpoint returns a recovery flow's context with, for example, error details and other information. + GetRecoveryFlow Get Recovery Flow + + This endpoint returns a recovery flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -470,20 +465,20 @@ type FrontendApi interface { ``` More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetRecoveryFlowRequest */ - GetRecoveryFlow(ctx context.Context) FrontendApiApiGetRecoveryFlowRequest + GetRecoveryFlow(ctx context.Context) FrontendApiGetRecoveryFlowRequest - /* - * GetRecoveryFlowExecute executes the request - * @return RecoveryFlow - */ - GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) + // GetRecoveryFlowExecute executes the request + // @return RecoveryFlow + GetRecoveryFlowExecute(r FrontendApiGetRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) /* - * GetRegistrationFlow Get Registration Flow - * This endpoint returns a registration flow's context with, for example, error details and other information. + GetRegistrationFlow Get Registration Flow + + This endpoint returns a registration flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -506,20 +501,20 @@ type FrontendApi interface { `self_service_flow_expired`: The flow is expired and you should request a new one. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetRegistrationFlowRequest */ - GetRegistrationFlow(ctx context.Context) FrontendApiApiGetRegistrationFlowRequest + GetRegistrationFlow(ctx context.Context) FrontendApiGetRegistrationFlowRequest - /* - * GetRegistrationFlowExecute executes the request - * @return RegistrationFlow - */ - GetRegistrationFlowExecute(r FrontendApiApiGetRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) + // GetRegistrationFlowExecute executes the request + // @return RegistrationFlow + GetRegistrationFlowExecute(r FrontendApiGetRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) /* - * GetSettingsFlow Get Settings Flow - * When accessing this endpoint through Ory Kratos' Public API you must ensure that either the Ory Kratos Session Cookie + GetSettingsFlow Get Settings Flow + + When accessing this endpoint through Ory Kratos' Public API you must ensure that either the Ory Kratos Session Cookie or the Ory Kratos Session Token are set. Depending on your configuration this endpoint might return a 403 error if the session has a lower Authenticator @@ -538,20 +533,20 @@ type FrontendApi interface { identity logged in instead. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetSettingsFlowRequest */ - GetSettingsFlow(ctx context.Context) FrontendApiApiGetSettingsFlowRequest + GetSettingsFlow(ctx context.Context) FrontendApiGetSettingsFlowRequest - /* - * GetSettingsFlowExecute executes the request - * @return SettingsFlow - */ - GetSettingsFlowExecute(r FrontendApiApiGetSettingsFlowRequest) (*SettingsFlow, *http.Response, error) + // GetSettingsFlowExecute executes the request + // @return SettingsFlow + GetSettingsFlowExecute(r FrontendApiGetSettingsFlowRequest) (*SettingsFlow, *http.Response, error) /* - * GetVerificationFlow Get Verification Flow - * This endpoint returns a verification flow's context with, for example, error details and other information. + GetVerificationFlow Get Verification Flow + + This endpoint returns a verification flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -569,20 +564,20 @@ type FrontendApi interface { ``` More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetVerificationFlowRequest */ - GetVerificationFlow(ctx context.Context) FrontendApiApiGetVerificationFlowRequest + GetVerificationFlow(ctx context.Context) FrontendApiGetVerificationFlowRequest - /* - * GetVerificationFlowExecute executes the request - * @return VerificationFlow - */ - GetVerificationFlowExecute(r FrontendApiApiGetVerificationFlowRequest) (*VerificationFlow, *http.Response, error) + // GetVerificationFlowExecute executes the request + // @return VerificationFlow + GetVerificationFlowExecute(r FrontendApiGetVerificationFlowRequest) (*VerificationFlow, *http.Response, error) /* - * GetWebAuthnJavaScript Get WebAuthn JavaScript - * This endpoint provides JavaScript which is needed in order to perform WebAuthn login and registration. + GetWebAuthnJavaScript Get WebAuthn JavaScript + + This endpoint provides JavaScript which is needed in order to perform WebAuthn login and registration. If you are building a JavaScript Browser App (e.g. in ReactJS or AngularJS) you will need to load this file: @@ -591,35 +586,35 @@ type FrontendApi interface { ``` More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetWebAuthnJavaScriptRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetWebAuthnJavaScriptRequest */ - GetWebAuthnJavaScript(ctx context.Context) FrontendApiApiGetWebAuthnJavaScriptRequest + GetWebAuthnJavaScript(ctx context.Context) FrontendApiGetWebAuthnJavaScriptRequest - /* - * GetWebAuthnJavaScriptExecute executes the request - * @return string - */ - GetWebAuthnJavaScriptExecute(r FrontendApiApiGetWebAuthnJavaScriptRequest) (string, *http.Response, error) + // GetWebAuthnJavaScriptExecute executes the request + // @return string + GetWebAuthnJavaScriptExecute(r FrontendApiGetWebAuthnJavaScriptRequest) (string, *http.Response, error) /* - * ListMySessions Get My Active Sessions - * This endpoints returns all other active sessions that belong to the logged-in user. + ListMySessions Get My Active Sessions + + This endpoints returns all other active sessions that belong to the logged-in user. The current session can be retrieved by calling the `/sessions/whoami` endpoint. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiListMySessionsRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiListMySessionsRequest */ - ListMySessions(ctx context.Context) FrontendApiApiListMySessionsRequest + ListMySessions(ctx context.Context) FrontendApiListMySessionsRequest - /* - * ListMySessionsExecute executes the request - * @return []Session - */ - ListMySessionsExecute(r FrontendApiApiListMySessionsRequest) ([]Session, *http.Response, error) + // ListMySessionsExecute executes the request + // @return []Session + ListMySessionsExecute(r FrontendApiListMySessionsRequest) ([]Session, *http.Response, error) /* - * PerformNativeLogout Perform Logout for Native Apps - * Use this endpoint to log out an identity using an Ory Session Token. If the Ory Session Token was successfully + PerformNativeLogout Perform Logout for Native Apps + + Use this endpoint to log out an identity using an Ory Session Token. If the Ory Session Token was successfully revoked, the server returns a 204 No Content response. A 204 No Content response is also sent when the Ory Session Token has been revoked already before. @@ -627,19 +622,19 @@ type FrontendApi interface { This endpoint does not remove any HTTP Cookies - use the Browser-Based Self-Service Logout Flow instead. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiPerformNativeLogoutRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiPerformNativeLogoutRequest */ - PerformNativeLogout(ctx context.Context) FrontendApiApiPerformNativeLogoutRequest + PerformNativeLogout(ctx context.Context) FrontendApiPerformNativeLogoutRequest - /* - * PerformNativeLogoutExecute executes the request - */ - PerformNativeLogoutExecute(r FrontendApiApiPerformNativeLogoutRequest) (*http.Response, error) + // PerformNativeLogoutExecute executes the request + PerformNativeLogoutExecute(r FrontendApiPerformNativeLogoutRequest) (*http.Response, error) /* - * ToSession Check Who the Current HTTP Session Belongs To - * Uses the HTTP Headers in the GET request to determine (e.g. by using checking the cookies) who is authenticated. + ToSession Check Who the Current HTTP Session Belongs To + + Uses the HTTP Headers in the GET request to determine (e.g. by using checking the cookies) who is authenticated. Returns a session object in the body or 401 if the credentials are invalid or no credentials were sent. When the request it successful it adds the user ID to the 'X-Kratos-Authenticated-Identity-Id' header in the response. @@ -698,20 +693,20 @@ type FrontendApi interface { `session_inactive`: No active session was found in the request (e.g. no Ory Session Cookie / Ory Session Token). `session_aal2_required`: An active session was found but it does not fulfil the Authenticator Assurance Level, implying that the session must (e.g.) authenticate the second factor. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiToSessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiToSessionRequest */ - ToSession(ctx context.Context) FrontendApiApiToSessionRequest + ToSession(ctx context.Context) FrontendApiToSessionRequest - /* - * ToSessionExecute executes the request - * @return Session - */ - ToSessionExecute(r FrontendApiApiToSessionRequest) (*Session, *http.Response, error) + // ToSessionExecute executes the request + // @return Session + ToSessionExecute(r FrontendApiToSessionRequest) (*Session, *http.Response, error) /* - * UpdateLoginFlow Submit a Login Flow - * Use this endpoint to complete a login flow. This endpoint + UpdateLoginFlow Submit a Login Flow + + Use this endpoint to complete a login flow. This endpoint behaves differently for API and browser flows. API flows expect `application/json` to be sent in the body and responds with @@ -738,20 +733,20 @@ type FrontendApi interface { Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiUpdateLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateLoginFlowRequest */ - UpdateLoginFlow(ctx context.Context) FrontendApiApiUpdateLoginFlowRequest + UpdateLoginFlow(ctx context.Context) FrontendApiUpdateLoginFlowRequest - /* - * UpdateLoginFlowExecute executes the request - * @return SuccessfulNativeLogin - */ - UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginFlowRequest) (*SuccessfulNativeLogin, *http.Response, error) + // UpdateLoginFlowExecute executes the request + // @return SuccessfulNativeLogin + UpdateLoginFlowExecute(r FrontendApiUpdateLoginFlowRequest) (*SuccessfulNativeLogin, *http.Response, error) /* - * UpdateLogoutFlow Update Logout Flow - * This endpoint logs out an identity in a self-service manner. + UpdateLogoutFlow Update Logout Flow + + This endpoint logs out an identity in a self-service manner. If the `Accept` HTTP header is not set to `application/json`, the browser will be redirected (HTTP 303 See Other) to the `return_to` parameter of the initial request or fall back to `urls.default_return_to`. @@ -764,19 +759,19 @@ type FrontendApi interface { call the `/self-service/logout/api` URL directly with the Ory Session Token. More information can be found at [Ory Kratos User Logout Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-logout). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiUpdateLogoutFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateLogoutFlowRequest */ - UpdateLogoutFlow(ctx context.Context) FrontendApiApiUpdateLogoutFlowRequest + UpdateLogoutFlow(ctx context.Context) FrontendApiUpdateLogoutFlowRequest - /* - * UpdateLogoutFlowExecute executes the request - */ - UpdateLogoutFlowExecute(r FrontendApiApiUpdateLogoutFlowRequest) (*http.Response, error) + // UpdateLogoutFlowExecute executes the request + UpdateLogoutFlowExecute(r FrontendApiUpdateLogoutFlowRequest) (*http.Response, error) /* - * UpdateRecoveryFlow Update Recovery Flow - * Use this endpoint to update a recovery flow. This endpoint + UpdateRecoveryFlow Update Recovery Flow + + Use this endpoint to update a recovery flow. This endpoint behaves differently for API and browser flows and has several states: `choose_method` expects `flow` (in the URL query) and `email` (in the body) to be sent @@ -792,20 +787,20 @@ type FrontendApi interface { a new Recovery Flow ID which contains an error message that the recovery link was invalid. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiUpdateRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateRecoveryFlowRequest */ - UpdateRecoveryFlow(ctx context.Context) FrontendApiApiUpdateRecoveryFlowRequest + UpdateRecoveryFlow(ctx context.Context) FrontendApiUpdateRecoveryFlowRequest - /* - * UpdateRecoveryFlowExecute executes the request - * @return RecoveryFlow - */ - UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) + // UpdateRecoveryFlowExecute executes the request + // @return RecoveryFlow + UpdateRecoveryFlowExecute(r FrontendApiUpdateRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) /* - * UpdateRegistrationFlow Update Registration Flow - * Use this endpoint to complete a registration flow by sending an identity's traits and password. This endpoint + UpdateRegistrationFlow Update Registration Flow + + Use this endpoint to complete a registration flow by sending an identity's traits and password. This endpoint behaves differently for API and browser flows. API flows expect `application/json` to be sent in the body and respond with @@ -833,20 +828,20 @@ type FrontendApi interface { Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiUpdateRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateRegistrationFlowRequest */ - UpdateRegistrationFlow(ctx context.Context) FrontendApiApiUpdateRegistrationFlowRequest + UpdateRegistrationFlow(ctx context.Context) FrontendApiUpdateRegistrationFlowRequest - /* - * UpdateRegistrationFlowExecute executes the request - * @return SuccessfulNativeRegistration - */ - UpdateRegistrationFlowExecute(r FrontendApiApiUpdateRegistrationFlowRequest) (*SuccessfulNativeRegistration, *http.Response, error) + // UpdateRegistrationFlowExecute executes the request + // @return SuccessfulNativeRegistration + UpdateRegistrationFlowExecute(r FrontendApiUpdateRegistrationFlowRequest) (*SuccessfulNativeRegistration, *http.Response, error) /* - * UpdateSettingsFlow Complete Settings Flow - * Use this endpoint to complete a settings flow by sending an identity's updated password. This endpoint + UpdateSettingsFlow Complete Settings Flow + + Use this endpoint to complete a settings flow by sending an identity's updated password. This endpoint behaves differently for API and browser flows. API-initiated flows expect `application/json` to be sent in the body and respond with @@ -889,20 +884,20 @@ type FrontendApi interface { Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiUpdateSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateSettingsFlowRequest */ - UpdateSettingsFlow(ctx context.Context) FrontendApiApiUpdateSettingsFlowRequest + UpdateSettingsFlow(ctx context.Context) FrontendApiUpdateSettingsFlowRequest - /* - * UpdateSettingsFlowExecute executes the request - * @return SettingsFlow - */ - UpdateSettingsFlowExecute(r FrontendApiApiUpdateSettingsFlowRequest) (*SettingsFlow, *http.Response, error) + // UpdateSettingsFlowExecute executes the request + // @return SettingsFlow + UpdateSettingsFlowExecute(r FrontendApiUpdateSettingsFlowRequest) (*SettingsFlow, *http.Response, error) /* - * UpdateVerificationFlow Complete Verification Flow - * Use this endpoint to complete a verification flow. This endpoint + UpdateVerificationFlow Complete Verification Flow + + Use this endpoint to complete a verification flow. This endpoint behaves differently for API and browser flows and has several states: `choose_method` expects `flow` (in the URL query) and `email` (in the body) to be sent @@ -918,22 +913,21 @@ type FrontendApi interface { a new Verification Flow ID which contains an error message that the verification link was invalid. More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiUpdateVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateVerificationFlowRequest */ - UpdateVerificationFlow(ctx context.Context) FrontendApiApiUpdateVerificationFlowRequest + UpdateVerificationFlow(ctx context.Context) FrontendApiUpdateVerificationFlowRequest - /* - * UpdateVerificationFlowExecute executes the request - * @return VerificationFlow - */ - UpdateVerificationFlowExecute(r FrontendApiApiUpdateVerificationFlowRequest) (*VerificationFlow, *http.Response, error) + // UpdateVerificationFlowExecute executes the request + // @return VerificationFlow + UpdateVerificationFlowExecute(r FrontendApiUpdateVerificationFlowRequest) (*VerificationFlow, *http.Response, error) } // FrontendApiService FrontendApi service type FrontendApiService service -type FrontendApiApiCreateBrowserLoginFlowRequest struct { +type FrontendApiCreateBrowserLoginFlowRequest struct { ctx context.Context ApiService FrontendApi refresh *bool @@ -944,39 +938,50 @@ type FrontendApiApiCreateBrowserLoginFlowRequest struct { organization *string } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) Refresh(refresh bool) FrontendApiApiCreateBrowserLoginFlowRequest { +// Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session. +func (r FrontendApiCreateBrowserLoginFlowRequest) Refresh(refresh bool) FrontendApiCreateBrowserLoginFlowRequest { r.refresh = &refresh return r } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) Aal(aal string) FrontendApiApiCreateBrowserLoginFlowRequest { + +// Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session's authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session's security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\". +func (r FrontendApiCreateBrowserLoginFlowRequest) Aal(aal string) FrontendApiCreateBrowserLoginFlowRequest { r.aal = &aal return r } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateBrowserLoginFlowRequest { + +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateBrowserLoginFlowRequest) ReturnTo(returnTo string) FrontendApiCreateBrowserLoginFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) Cookie(cookie string) FrontendApiApiCreateBrowserLoginFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiCreateBrowserLoginFlowRequest) Cookie(cookie string) FrontendApiCreateBrowserLoginFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) LoginChallenge(loginChallenge string) FrontendApiApiCreateBrowserLoginFlowRequest { + +// An optional Hydra login challenge. If present, Kratos will cooperate with Ory Hydra to act as an OAuth2 identity provider. The value for this parameter comes from `login_challenge` URL Query parameter sent to your application (e.g. `/login?login_challenge=abcde`). +func (r FrontendApiCreateBrowserLoginFlowRequest) LoginChallenge(loginChallenge string) FrontendApiCreateBrowserLoginFlowRequest { r.loginChallenge = &loginChallenge return r } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) Organization(organization string) FrontendApiApiCreateBrowserLoginFlowRequest { + +// An optional organization ID that should be used for logging this user in. This parameter is only effective in the Ory Network. +func (r FrontendApiCreateBrowserLoginFlowRequest) Organization(organization string) FrontendApiCreateBrowserLoginFlowRequest { r.organization = &organization return r } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) Execute() (*LoginFlow, *http.Response, error) { +func (r FrontendApiCreateBrowserLoginFlowRequest) Execute() (*LoginFlow, *http.Response, error) { return r.ApiService.CreateBrowserLoginFlowExecute(r) } /* - - CreateBrowserLoginFlow Create Login Flow for Browsers - - This endpoint initializes a browser-based user login flow. This endpoint will set the appropriate +CreateBrowserLoginFlow Create Login Flow for Browsers +This endpoint initializes a browser-based user login flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. If this endpoint is opened as a link in the browser, it will be redirected to @@ -999,28 +1004,26 @@ option. This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateBrowserLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserLoginFlowRequest */ -func (a *FrontendApiService) CreateBrowserLoginFlow(ctx context.Context) FrontendApiApiCreateBrowserLoginFlowRequest { - return FrontendApiApiCreateBrowserLoginFlowRequest{ +func (a *FrontendApiService) CreateBrowserLoginFlow(ctx context.Context) FrontendApiCreateBrowserLoginFlowRequest { + return FrontendApiCreateBrowserLoginFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return LoginFlow - */ -func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiApiCreateBrowserLoginFlowRequest) (*LoginFlow, *http.Response, error) { +// Execute executes the request +// +// @return LoginFlow +func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiCreateBrowserLoginFlowRequest) (*LoginFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *LoginFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LoginFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateBrowserLoginFlow") @@ -1035,19 +1038,19 @@ func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiApiCreat localVarFormParams := url.Values{} if r.refresh != nil { - localVarQueryParams.Add("refresh", parameterToString(*r.refresh, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "refresh", r.refresh, "") } if r.aal != nil { - localVarQueryParams.Add("aal", parameterToString(*r.aal, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "aal", r.aal, "") } if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } if r.loginChallenge != nil { - localVarQueryParams.Add("login_challenge", parameterToString(*r.loginChallenge, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "login_challenge", r.loginChallenge, "") } if r.organization != nil { - localVarQueryParams.Add("organization", parameterToString(*r.organization, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "organization", r.organization, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1067,9 +1070,9 @@ func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiApiCreat localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1098,6 +1101,7 @@ func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiApiCreat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1107,6 +1111,7 @@ func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiApiCreat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1123,29 +1128,33 @@ func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiApiCreat return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateBrowserLogoutFlowRequest struct { +type FrontendApiCreateBrowserLogoutFlowRequest struct { ctx context.Context ApiService FrontendApi cookie *string returnTo *string } -func (r FrontendApiApiCreateBrowserLogoutFlowRequest) Cookie(cookie string) FrontendApiApiCreateBrowserLogoutFlowRequest { +// HTTP Cookies If you call this endpoint from a backend, please include the original Cookie header in the request. +func (r FrontendApiCreateBrowserLogoutFlowRequest) Cookie(cookie string) FrontendApiCreateBrowserLogoutFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiCreateBrowserLogoutFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateBrowserLogoutFlowRequest { + +// Return to URL The URL to which the browser should be redirected to after the logout has been performed. +func (r FrontendApiCreateBrowserLogoutFlowRequest) ReturnTo(returnTo string) FrontendApiCreateBrowserLogoutFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateBrowserLogoutFlowRequest) Execute() (*LogoutFlow, *http.Response, error) { +func (r FrontendApiCreateBrowserLogoutFlowRequest) Execute() (*LogoutFlow, *http.Response, error) { return r.ApiService.CreateBrowserLogoutFlowExecute(r) } /* - - CreateBrowserLogoutFlow Create a Logout URL for Browsers - - This endpoint initializes a browser-based user logout flow and a URL which can be used to log out the user. +CreateBrowserLogoutFlow Create a Logout URL for Browsers + +This endpoint initializes a browser-based user logout flow and a URL which can be used to log out the user. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). For API clients you can @@ -1155,28 +1164,26 @@ The URL is only valid for the currently signed in user. If no user is signed in, a 401 error. When calling this endpoint from a backend, please ensure to properly forward the HTTP cookies. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateBrowserLogoutFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserLogoutFlowRequest */ -func (a *FrontendApiService) CreateBrowserLogoutFlow(ctx context.Context) FrontendApiApiCreateBrowserLogoutFlowRequest { - return FrontendApiApiCreateBrowserLogoutFlowRequest{ +func (a *FrontendApiService) CreateBrowserLogoutFlow(ctx context.Context) FrontendApiCreateBrowserLogoutFlowRequest { + return FrontendApiCreateBrowserLogoutFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return LogoutFlow - */ -func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCreateBrowserLogoutFlowRequest) (*LogoutFlow, *http.Response, error) { +// Execute executes the request +// +// @return LogoutFlow +func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiCreateBrowserLogoutFlowRequest) (*LogoutFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *LogoutFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogoutFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateBrowserLogoutFlow") @@ -1191,7 +1198,7 @@ func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCrea localVarFormParams := url.Values{} if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1211,9 +1218,9 @@ func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCrea localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1242,6 +1249,7 @@ func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCrea newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1252,6 +1260,7 @@ func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCrea newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1262,6 +1271,7 @@ func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCrea newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr @@ -1279,25 +1289,26 @@ func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCrea return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateBrowserRecoveryFlowRequest struct { +type FrontendApiCreateBrowserRecoveryFlowRequest struct { ctx context.Context ApiService FrontendApi returnTo *string } -func (r FrontendApiApiCreateBrowserRecoveryFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateBrowserRecoveryFlowRequest { +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateBrowserRecoveryFlowRequest) ReturnTo(returnTo string) FrontendApiCreateBrowserRecoveryFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateBrowserRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { +func (r FrontendApiCreateBrowserRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { return r.ApiService.CreateBrowserRecoveryFlowExecute(r) } /* - - CreateBrowserRecoveryFlow Create Recovery Flow for Browsers - - This endpoint initializes a browser-based account recovery flow. Once initialized, the browser will be redirected to +CreateBrowserRecoveryFlow Create Recovery Flow for Browsers +This endpoint initializes a browser-based account recovery flow. Once initialized, the browser will be redirected to `selfservice.flows.recovery.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists, the browser is returned to the configured return URL. @@ -1307,28 +1318,26 @@ or a 400 bad request error if the user is already authenticated. This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateBrowserRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserRecoveryFlowRequest */ -func (a *FrontendApiService) CreateBrowserRecoveryFlow(ctx context.Context) FrontendApiApiCreateBrowserRecoveryFlowRequest { - return FrontendApiApiCreateBrowserRecoveryFlowRequest{ +func (a *FrontendApiService) CreateBrowserRecoveryFlow(ctx context.Context) FrontendApiCreateBrowserRecoveryFlowRequest { + return FrontendApiCreateBrowserRecoveryFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RecoveryFlow - */ -func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiApiCreateBrowserRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { +// Execute executes the request +// +// @return RecoveryFlow +func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiCreateBrowserRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RecoveryFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateBrowserRecoveryFlow") @@ -1343,7 +1352,7 @@ func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiApiCr localVarFormParams := url.Values{} if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1362,7 +1371,7 @@ func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiApiCr if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1391,6 +1400,7 @@ func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiApiCr newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1400,6 +1410,7 @@ func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiApiCr newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1416,7 +1427,7 @@ func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiApiCr return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateBrowserRegistrationFlowRequest struct { +type FrontendApiCreateBrowserRegistrationFlowRequest struct { ctx context.Context ApiService FrontendApi returnTo *string @@ -1425,31 +1436,37 @@ type FrontendApiApiCreateBrowserRegistrationFlowRequest struct { organization *string } -func (r FrontendApiApiCreateBrowserRegistrationFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateBrowserRegistrationFlowRequest { +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateBrowserRegistrationFlowRequest) ReturnTo(returnTo string) FrontendApiCreateBrowserRegistrationFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateBrowserRegistrationFlowRequest) LoginChallenge(loginChallenge string) FrontendApiApiCreateBrowserRegistrationFlowRequest { + +// Ory OAuth 2.0 Login Challenge. If set will cooperate with Ory OAuth2 and OpenID to act as an OAuth2 server / OpenID Provider. The value for this parameter comes from `login_challenge` URL Query parameter sent to your application (e.g. `/registration?login_challenge=abcde`). This feature is compatible with Ory Hydra when not running on the Ory Network. +func (r FrontendApiCreateBrowserRegistrationFlowRequest) LoginChallenge(loginChallenge string) FrontendApiCreateBrowserRegistrationFlowRequest { r.loginChallenge = &loginChallenge return r } -func (r FrontendApiApiCreateBrowserRegistrationFlowRequest) AfterVerificationReturnTo(afterVerificationReturnTo string) FrontendApiApiCreateBrowserRegistrationFlowRequest { + +// The URL to return the browser to after the verification flow was completed. After the registration flow is completed, the user will be sent a verification email. Upon completing the verification flow, this URL will be used to override the default `selfservice.flows.verification.after.default_redirect_to` value. +func (r FrontendApiCreateBrowserRegistrationFlowRequest) AfterVerificationReturnTo(afterVerificationReturnTo string) FrontendApiCreateBrowserRegistrationFlowRequest { r.afterVerificationReturnTo = &afterVerificationReturnTo return r } -func (r FrontendApiApiCreateBrowserRegistrationFlowRequest) Organization(organization string) FrontendApiApiCreateBrowserRegistrationFlowRequest { + +func (r FrontendApiCreateBrowserRegistrationFlowRequest) Organization(organization string) FrontendApiCreateBrowserRegistrationFlowRequest { r.organization = &organization return r } -func (r FrontendApiApiCreateBrowserRegistrationFlowRequest) Execute() (*RegistrationFlow, *http.Response, error) { +func (r FrontendApiCreateBrowserRegistrationFlowRequest) Execute() (*RegistrationFlow, *http.Response, error) { return r.ApiService.CreateBrowserRegistrationFlowExecute(r) } /* - - CreateBrowserRegistrationFlow Create Registration Flow for Browsers - - This endpoint initializes a browser-based user registration flow. This endpoint will set the appropriate +CreateBrowserRegistrationFlow Create Registration Flow for Browsers +This endpoint initializes a browser-based user registration flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. If this endpoint is opened as a link in the browser, it will be redirected to @@ -1468,28 +1485,26 @@ If this endpoint is called via an AJAX request, the response contains the regist This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateBrowserRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserRegistrationFlowRequest */ -func (a *FrontendApiService) CreateBrowserRegistrationFlow(ctx context.Context) FrontendApiApiCreateBrowserRegistrationFlowRequest { - return FrontendApiApiCreateBrowserRegistrationFlowRequest{ +func (a *FrontendApiService) CreateBrowserRegistrationFlow(ctx context.Context) FrontendApiCreateBrowserRegistrationFlowRequest { + return FrontendApiCreateBrowserRegistrationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RegistrationFlow - */ -func (a *FrontendApiService) CreateBrowserRegistrationFlowExecute(r FrontendApiApiCreateBrowserRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) { +// Execute executes the request +// +// @return RegistrationFlow +func (a *FrontendApiService) CreateBrowserRegistrationFlowExecute(r FrontendApiCreateBrowserRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RegistrationFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegistrationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateBrowserRegistrationFlow") @@ -1504,16 +1519,16 @@ func (a *FrontendApiService) CreateBrowserRegistrationFlowExecute(r FrontendApiA localVarFormParams := url.Values{} if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } if r.loginChallenge != nil { - localVarQueryParams.Add("login_challenge", parameterToString(*r.loginChallenge, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "login_challenge", r.loginChallenge, "") } if r.afterVerificationReturnTo != nil { - localVarQueryParams.Add("after_verification_return_to", parameterToString(*r.afterVerificationReturnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "after_verification_return_to", r.afterVerificationReturnTo, "") } if r.organization != nil { - localVarQueryParams.Add("organization", parameterToString(*r.organization, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "organization", r.organization, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1532,7 +1547,7 @@ func (a *FrontendApiService) CreateBrowserRegistrationFlowExecute(r FrontendApiA if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1560,6 +1575,7 @@ func (a *FrontendApiService) CreateBrowserRegistrationFlowExecute(r FrontendApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1576,30 +1592,33 @@ func (a *FrontendApiService) CreateBrowserRegistrationFlowExecute(r FrontendApiA return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateBrowserSettingsFlowRequest struct { +type FrontendApiCreateBrowserSettingsFlowRequest struct { ctx context.Context ApiService FrontendApi returnTo *string cookie *string } -func (r FrontendApiApiCreateBrowserSettingsFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateBrowserSettingsFlowRequest { +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateBrowserSettingsFlowRequest) ReturnTo(returnTo string) FrontendApiCreateBrowserSettingsFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateBrowserSettingsFlowRequest) Cookie(cookie string) FrontendApiApiCreateBrowserSettingsFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiCreateBrowserSettingsFlowRequest) Cookie(cookie string) FrontendApiCreateBrowserSettingsFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiCreateBrowserSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { +func (r FrontendApiCreateBrowserSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { return r.ApiService.CreateBrowserSettingsFlowExecute(r) } /* - - CreateBrowserSettingsFlow Create Settings Flow for Browsers - - This endpoint initializes a browser-based user settings flow. Once initialized, the browser will be redirected to +CreateBrowserSettingsFlow Create Settings Flow for Browsers +This endpoint initializes a browser-based user settings flow. Once initialized, the browser will be redirected to `selfservice.flows.settings.ui_url` with the flow ID set as the query parameter `?flow=`. If no valid Ory Kratos Session Cookie is included in the request, a login flow will be initialized. @@ -1625,28 +1644,26 @@ case of an error, the `error.id` of the JSON response body can be one of: This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateBrowserSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserSettingsFlowRequest */ -func (a *FrontendApiService) CreateBrowserSettingsFlow(ctx context.Context) FrontendApiApiCreateBrowserSettingsFlowRequest { - return FrontendApiApiCreateBrowserSettingsFlowRequest{ +func (a *FrontendApiService) CreateBrowserSettingsFlow(ctx context.Context) FrontendApiCreateBrowserSettingsFlowRequest { + return FrontendApiCreateBrowserSettingsFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SettingsFlow - */ -func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCreateBrowserSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { +// Execute executes the request +// +// @return SettingsFlow +func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiCreateBrowserSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SettingsFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SettingsFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateBrowserSettingsFlow") @@ -1661,7 +1678,7 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr localVarFormParams := url.Values{} if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1681,9 +1698,9 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1712,6 +1729,7 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1722,6 +1740,7 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1732,6 +1751,7 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1741,6 +1761,7 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1757,25 +1778,26 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateBrowserVerificationFlowRequest struct { +type FrontendApiCreateBrowserVerificationFlowRequest struct { ctx context.Context ApiService FrontendApi returnTo *string } -func (r FrontendApiApiCreateBrowserVerificationFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateBrowserVerificationFlowRequest { +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateBrowserVerificationFlowRequest) ReturnTo(returnTo string) FrontendApiCreateBrowserVerificationFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateBrowserVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { +func (r FrontendApiCreateBrowserVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { return r.ApiService.CreateBrowserVerificationFlowExecute(r) } /* - - CreateBrowserVerificationFlow Create Verification Flow for Browser Clients - - This endpoint initializes a browser-based account verification flow. Once initialized, the browser will be redirected to +CreateBrowserVerificationFlow Create Verification Flow for Browser Clients +This endpoint initializes a browser-based account verification flow. Once initialized, the browser will be redirected to `selfservice.flows.verification.ui_url` with the flow ID set as the query parameter `?flow=`. If this endpoint is called via an AJAX request, the response contains the recovery flow without any redirects. @@ -1783,28 +1805,26 @@ If this endpoint is called via an AJAX request, the response contains the recove This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateBrowserVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserVerificationFlowRequest */ -func (a *FrontendApiService) CreateBrowserVerificationFlow(ctx context.Context) FrontendApiApiCreateBrowserVerificationFlowRequest { - return FrontendApiApiCreateBrowserVerificationFlowRequest{ +func (a *FrontendApiService) CreateBrowserVerificationFlow(ctx context.Context) FrontendApiCreateBrowserVerificationFlowRequest { + return FrontendApiCreateBrowserVerificationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return VerificationFlow - */ -func (a *FrontendApiService) CreateBrowserVerificationFlowExecute(r FrontendApiApiCreateBrowserVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { +// Execute executes the request +// +// @return VerificationFlow +func (a *FrontendApiService) CreateBrowserVerificationFlowExecute(r FrontendApiCreateBrowserVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *VerificationFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VerificationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateBrowserVerificationFlow") @@ -1819,7 +1839,7 @@ func (a *FrontendApiService) CreateBrowserVerificationFlowExecute(r FrontendApiA localVarFormParams := url.Values{} if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1838,7 +1858,7 @@ func (a *FrontendApiService) CreateBrowserVerificationFlowExecute(r FrontendApiA if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1866,6 +1886,7 @@ func (a *FrontendApiService) CreateBrowserVerificationFlowExecute(r FrontendApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1882,7 +1903,7 @@ func (a *FrontendApiService) CreateBrowserVerificationFlowExecute(r FrontendApiA return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateNativeLoginFlowRequest struct { +type FrontendApiCreateNativeLoginFlowRequest struct { ctx context.Context ApiService FrontendApi refresh *bool @@ -1893,38 +1914,50 @@ type FrontendApiApiCreateNativeLoginFlowRequest struct { via *string } -func (r FrontendApiApiCreateNativeLoginFlowRequest) Refresh(refresh bool) FrontendApiApiCreateNativeLoginFlowRequest { +// Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session. +func (r FrontendApiCreateNativeLoginFlowRequest) Refresh(refresh bool) FrontendApiCreateNativeLoginFlowRequest { r.refresh = &refresh return r } -func (r FrontendApiApiCreateNativeLoginFlowRequest) Aal(aal string) FrontendApiApiCreateNativeLoginFlowRequest { + +// Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session's authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session's security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\". +func (r FrontendApiCreateNativeLoginFlowRequest) Aal(aal string) FrontendApiCreateNativeLoginFlowRequest { r.aal = &aal return r } -func (r FrontendApiApiCreateNativeLoginFlowRequest) XSessionToken(xSessionToken string) FrontendApiApiCreateNativeLoginFlowRequest { + +// The Session Token of the Identity performing the settings flow. +func (r FrontendApiCreateNativeLoginFlowRequest) XSessionToken(xSessionToken string) FrontendApiCreateNativeLoginFlowRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiCreateNativeLoginFlowRequest) ReturnSessionTokenExchangeCode(returnSessionTokenExchangeCode bool) FrontendApiApiCreateNativeLoginFlowRequest { + +// EnableSessionTokenExchangeCode requests the login flow to include a code that can be used to retrieve the session token after the login flow has been completed. +func (r FrontendApiCreateNativeLoginFlowRequest) ReturnSessionTokenExchangeCode(returnSessionTokenExchangeCode bool) FrontendApiCreateNativeLoginFlowRequest { r.returnSessionTokenExchangeCode = &returnSessionTokenExchangeCode return r } -func (r FrontendApiApiCreateNativeLoginFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateNativeLoginFlowRequest { + +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateNativeLoginFlowRequest) ReturnTo(returnTo string) FrontendApiCreateNativeLoginFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateNativeLoginFlowRequest) Via(via string) FrontendApiApiCreateNativeLoginFlowRequest { + +// Via should contain the identity's credential the code should be sent to. Only relevant in aal2 flows. +func (r FrontendApiCreateNativeLoginFlowRequest) Via(via string) FrontendApiCreateNativeLoginFlowRequest { r.via = &via return r } -func (r FrontendApiApiCreateNativeLoginFlowRequest) Execute() (*LoginFlow, *http.Response, error) { +func (r FrontendApiCreateNativeLoginFlowRequest) Execute() (*LoginFlow, *http.Response, error) { return r.ApiService.CreateNativeLoginFlowExecute(r) } /* - - CreateNativeLoginFlow Create Login Flow for Native Apps - - This endpoint initiates a login flow for native apps that do not use a browser, such as mobile devices, smart TVs, and so on. +CreateNativeLoginFlow Create Login Flow for Native Apps + +This endpoint initiates a login flow for native apps that do not use a browser, such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. @@ -1944,28 +1977,26 @@ In the case of an error, the `error.id` of the JSON response body can be one of: This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateNativeLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeLoginFlowRequest */ -func (a *FrontendApiService) CreateNativeLoginFlow(ctx context.Context) FrontendApiApiCreateNativeLoginFlowRequest { - return FrontendApiApiCreateNativeLoginFlowRequest{ +func (a *FrontendApiService) CreateNativeLoginFlow(ctx context.Context) FrontendApiCreateNativeLoginFlowRequest { + return FrontendApiCreateNativeLoginFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return LoginFlow - */ -func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiApiCreateNativeLoginFlowRequest) (*LoginFlow, *http.Response, error) { +// Execute executes the request +// +// @return LoginFlow +func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiCreateNativeLoginFlowRequest) (*LoginFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *LoginFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LoginFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateNativeLoginFlow") @@ -1980,19 +2011,19 @@ func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiApiCreate localVarFormParams := url.Values{} if r.refresh != nil { - localVarQueryParams.Add("refresh", parameterToString(*r.refresh, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "refresh", r.refresh, "") } if r.aal != nil { - localVarQueryParams.Add("aal", parameterToString(*r.aal, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "aal", r.aal, "") } if r.returnSessionTokenExchangeCode != nil { - localVarQueryParams.Add("return_session_token_exchange_code", parameterToString(*r.returnSessionTokenExchangeCode, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_session_token_exchange_code", r.returnSessionTokenExchangeCode, "") } if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } if r.via != nil { - localVarQueryParams.Add("via", parameterToString(*r.via, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "via", r.via, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2012,9 +2043,9 @@ func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiApiCreate localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2043,6 +2074,7 @@ func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiApiCreate newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2052,6 +2084,7 @@ func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiApiCreate newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2068,18 +2101,19 @@ func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiApiCreate return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateNativeRecoveryFlowRequest struct { +type FrontendApiCreateNativeRecoveryFlowRequest struct { ctx context.Context ApiService FrontendApi } -func (r FrontendApiApiCreateNativeRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { +func (r FrontendApiCreateNativeRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { return r.ApiService.CreateNativeRecoveryFlowExecute(r) } /* - - CreateNativeRecoveryFlow Create Recovery Flow for Native Apps - - This endpoint initiates a recovery flow for API clients such as mobile devices, smart TVs, and so on. +CreateNativeRecoveryFlow Create Recovery Flow for Native Apps + +This endpoint initiates a recovery flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error. @@ -2092,28 +2126,26 @@ you vulnerable to a variety of CSRF attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateNativeRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeRecoveryFlowRequest */ -func (a *FrontendApiService) CreateNativeRecoveryFlow(ctx context.Context) FrontendApiApiCreateNativeRecoveryFlowRequest { - return FrontendApiApiCreateNativeRecoveryFlowRequest{ +func (a *FrontendApiService) CreateNativeRecoveryFlow(ctx context.Context) FrontendApiCreateNativeRecoveryFlowRequest { + return FrontendApiCreateNativeRecoveryFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RecoveryFlow - */ -func (a *FrontendApiService) CreateNativeRecoveryFlowExecute(r FrontendApiApiCreateNativeRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { +// Execute executes the request +// +// @return RecoveryFlow +func (a *FrontendApiService) CreateNativeRecoveryFlowExecute(r FrontendApiCreateNativeRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RecoveryFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateNativeRecoveryFlow") @@ -2144,7 +2176,7 @@ func (a *FrontendApiService) CreateNativeRecoveryFlowExecute(r FrontendApiApiCre if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2173,6 +2205,7 @@ func (a *FrontendApiService) CreateNativeRecoveryFlowExecute(r FrontendApiApiCre newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2182,6 +2215,7 @@ func (a *FrontendApiService) CreateNativeRecoveryFlowExecute(r FrontendApiApiCre newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2198,29 +2232,33 @@ func (a *FrontendApiService) CreateNativeRecoveryFlowExecute(r FrontendApiApiCre return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateNativeRegistrationFlowRequest struct { +type FrontendApiCreateNativeRegistrationFlowRequest struct { ctx context.Context ApiService FrontendApi returnSessionTokenExchangeCode *bool returnTo *string } -func (r FrontendApiApiCreateNativeRegistrationFlowRequest) ReturnSessionTokenExchangeCode(returnSessionTokenExchangeCode bool) FrontendApiApiCreateNativeRegistrationFlowRequest { +// EnableSessionTokenExchangeCode requests the login flow to include a code that can be used to retrieve the session token after the login flow has been completed. +func (r FrontendApiCreateNativeRegistrationFlowRequest) ReturnSessionTokenExchangeCode(returnSessionTokenExchangeCode bool) FrontendApiCreateNativeRegistrationFlowRequest { r.returnSessionTokenExchangeCode = &returnSessionTokenExchangeCode return r } -func (r FrontendApiApiCreateNativeRegistrationFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateNativeRegistrationFlowRequest { + +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateNativeRegistrationFlowRequest) ReturnTo(returnTo string) FrontendApiCreateNativeRegistrationFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateNativeRegistrationFlowRequest) Execute() (*RegistrationFlow, *http.Response, error) { +func (r FrontendApiCreateNativeRegistrationFlowRequest) Execute() (*RegistrationFlow, *http.Response, error) { return r.ApiService.CreateNativeRegistrationFlowExecute(r) } /* - - CreateNativeRegistrationFlow Create Registration Flow for Native Apps - - This endpoint initiates a registration flow for API clients such as mobile devices, smart TVs, and so on. +CreateNativeRegistrationFlow Create Registration Flow for Native Apps + +This endpoint initiates a registration flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. @@ -2239,28 +2277,26 @@ In the case of an error, the `error.id` of the JSON response body can be one of: This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateNativeRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeRegistrationFlowRequest */ -func (a *FrontendApiService) CreateNativeRegistrationFlow(ctx context.Context) FrontendApiApiCreateNativeRegistrationFlowRequest { - return FrontendApiApiCreateNativeRegistrationFlowRequest{ +func (a *FrontendApiService) CreateNativeRegistrationFlow(ctx context.Context) FrontendApiCreateNativeRegistrationFlowRequest { + return FrontendApiCreateNativeRegistrationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RegistrationFlow - */ -func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiApiCreateNativeRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) { +// Execute executes the request +// +// @return RegistrationFlow +func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiCreateNativeRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RegistrationFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegistrationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateNativeRegistrationFlow") @@ -2275,10 +2311,10 @@ func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiAp localVarFormParams := url.Values{} if r.returnSessionTokenExchangeCode != nil { - localVarQueryParams.Add("return_session_token_exchange_code", parameterToString(*r.returnSessionTokenExchangeCode, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_session_token_exchange_code", r.returnSessionTokenExchangeCode, "") } if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2297,7 +2333,7 @@ func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiAp if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2326,6 +2362,7 @@ func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiAp newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2335,6 +2372,7 @@ func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiAp newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2351,25 +2389,26 @@ func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiAp return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateNativeSettingsFlowRequest struct { +type FrontendApiCreateNativeSettingsFlowRequest struct { ctx context.Context ApiService FrontendApi xSessionToken *string } -func (r FrontendApiApiCreateNativeSettingsFlowRequest) XSessionToken(xSessionToken string) FrontendApiApiCreateNativeSettingsFlowRequest { +// The Session Token of the Identity performing the settings flow. +func (r FrontendApiCreateNativeSettingsFlowRequest) XSessionToken(xSessionToken string) FrontendApiCreateNativeSettingsFlowRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiCreateNativeSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { +func (r FrontendApiCreateNativeSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { return r.ApiService.CreateNativeSettingsFlowExecute(r) } /* - - CreateNativeSettingsFlow Create Settings Flow for Native Apps - - This endpoint initiates a settings flow for API clients such as mobile devices, smart TVs, and so on. +CreateNativeSettingsFlow Create Settings Flow for Native Apps +This endpoint initiates a settings flow for API clients such as mobile devices, smart TVs, and so on. You must provide a valid Ory Kratos Session Token for this endpoint to respond with HTTP 200 OK. To fetch an existing settings flow call `/self-service/settings/flows?flow=`. @@ -2391,28 +2430,26 @@ In the case of an error, the `error.id` of the JSON response body can be one of: This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateNativeSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeSettingsFlowRequest */ -func (a *FrontendApiService) CreateNativeSettingsFlow(ctx context.Context) FrontendApiApiCreateNativeSettingsFlowRequest { - return FrontendApiApiCreateNativeSettingsFlowRequest{ +func (a *FrontendApiService) CreateNativeSettingsFlow(ctx context.Context) FrontendApiCreateNativeSettingsFlowRequest { + return FrontendApiCreateNativeSettingsFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SettingsFlow - */ -func (a *FrontendApiService) CreateNativeSettingsFlowExecute(r FrontendApiApiCreateNativeSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { +// Execute executes the request +// +// @return SettingsFlow +func (a *FrontendApiService) CreateNativeSettingsFlowExecute(r FrontendApiCreateNativeSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SettingsFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SettingsFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateNativeSettingsFlow") @@ -2444,9 +2481,9 @@ func (a *FrontendApiService) CreateNativeSettingsFlowExecute(r FrontendApiApiCre localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2475,6 +2512,7 @@ func (a *FrontendApiService) CreateNativeSettingsFlowExecute(r FrontendApiApiCre newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2484,6 +2522,7 @@ func (a *FrontendApiService) CreateNativeSettingsFlowExecute(r FrontendApiApiCre newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2500,18 +2539,19 @@ func (a *FrontendApiService) CreateNativeSettingsFlowExecute(r FrontendApiApiCre return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateNativeVerificationFlowRequest struct { +type FrontendApiCreateNativeVerificationFlowRequest struct { ctx context.Context ApiService FrontendApi } -func (r FrontendApiApiCreateNativeVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { +func (r FrontendApiCreateNativeVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { return r.ApiService.CreateNativeVerificationFlowExecute(r) } /* - - CreateNativeVerificationFlow Create Verification Flow for Native Apps - - This endpoint initiates a verification flow for API clients such as mobile devices, smart TVs, and so on. +CreateNativeVerificationFlow Create Verification Flow for Native Apps + +This endpoint initiates a verification flow for API clients such as mobile devices, smart TVs, and so on. To fetch an existing verification flow call `/self-service/verification/flows?flow=`. @@ -2522,28 +2562,26 @@ you vulnerable to a variety of CSRF attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateNativeVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeVerificationFlowRequest */ -func (a *FrontendApiService) CreateNativeVerificationFlow(ctx context.Context) FrontendApiApiCreateNativeVerificationFlowRequest { - return FrontendApiApiCreateNativeVerificationFlowRequest{ +func (a *FrontendApiService) CreateNativeVerificationFlow(ctx context.Context) FrontendApiCreateNativeVerificationFlowRequest { + return FrontendApiCreateNativeVerificationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return VerificationFlow - */ -func (a *FrontendApiService) CreateNativeVerificationFlowExecute(r FrontendApiApiCreateNativeVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { +// Execute executes the request +// +// @return VerificationFlow +func (a *FrontendApiService) CreateNativeVerificationFlowExecute(r FrontendApiCreateNativeVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *VerificationFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VerificationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateNativeVerificationFlow") @@ -2574,7 +2612,7 @@ func (a *FrontendApiService) CreateNativeVerificationFlowExecute(r FrontendApiAp if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2603,6 +2641,7 @@ func (a *FrontendApiService) CreateNativeVerificationFlowExecute(r FrontendApiAp newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2612,6 +2651,7 @@ func (a *FrontendApiService) CreateNativeVerificationFlowExecute(r FrontendApiAp newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2628,53 +2668,54 @@ func (a *FrontendApiService) CreateNativeVerificationFlowExecute(r FrontendApiAp return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiDisableMyOtherSessionsRequest struct { +type FrontendApiDisableMyOtherSessionsRequest struct { ctx context.Context ApiService FrontendApi xSessionToken *string cookie *string } -func (r FrontendApiApiDisableMyOtherSessionsRequest) XSessionToken(xSessionToken string) FrontendApiApiDisableMyOtherSessionsRequest { +// Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. +func (r FrontendApiDisableMyOtherSessionsRequest) XSessionToken(xSessionToken string) FrontendApiDisableMyOtherSessionsRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiDisableMyOtherSessionsRequest) Cookie(cookie string) FrontendApiApiDisableMyOtherSessionsRequest { + +// Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. +func (r FrontendApiDisableMyOtherSessionsRequest) Cookie(cookie string) FrontendApiDisableMyOtherSessionsRequest { r.cookie = &cookie return r } -func (r FrontendApiApiDisableMyOtherSessionsRequest) Execute() (*DeleteMySessionsCount, *http.Response, error) { +func (r FrontendApiDisableMyOtherSessionsRequest) Execute() (*DeleteMySessionsCount, *http.Response, error) { return r.ApiService.DisableMyOtherSessionsExecute(r) } /* - - DisableMyOtherSessions Disable my other sessions - - Calling this endpoint invalidates all except the current session that belong to the logged-in user. +DisableMyOtherSessions Disable my other sessions +Calling this endpoint invalidates all except the current session that belong to the logged-in user. Session data are not deleted. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiDisableMyOtherSessionsRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiDisableMyOtherSessionsRequest */ -func (a *FrontendApiService) DisableMyOtherSessions(ctx context.Context) FrontendApiApiDisableMyOtherSessionsRequest { - return FrontendApiApiDisableMyOtherSessionsRequest{ +func (a *FrontendApiService) DisableMyOtherSessions(ctx context.Context) FrontendApiDisableMyOtherSessionsRequest { + return FrontendApiDisableMyOtherSessionsRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return DeleteMySessionsCount - */ -func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiApiDisableMyOtherSessionsRequest) (*DeleteMySessionsCount, *http.Response, error) { +// Execute executes the request +// +// @return DeleteMySessionsCount +func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiDisableMyOtherSessionsRequest) (*DeleteMySessionsCount, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *DeleteMySessionsCount + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeleteMySessionsCount ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.DisableMyOtherSessions") @@ -2706,12 +2747,12 @@ func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiApiDisab localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2740,6 +2781,7 @@ func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiApiDisab newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2750,6 +2792,7 @@ func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiApiDisab newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2759,6 +2802,7 @@ func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiApiDisab newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2775,7 +2819,7 @@ func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiApiDisab return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiDisableMySessionRequest struct { +type FrontendApiDisableMySessionRequest struct { ctx context.Context ApiService FrontendApi id string @@ -2783,46 +2827,46 @@ type FrontendApiApiDisableMySessionRequest struct { cookie *string } -func (r FrontendApiApiDisableMySessionRequest) XSessionToken(xSessionToken string) FrontendApiApiDisableMySessionRequest { +// Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. +func (r FrontendApiDisableMySessionRequest) XSessionToken(xSessionToken string) FrontendApiDisableMySessionRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiDisableMySessionRequest) Cookie(cookie string) FrontendApiApiDisableMySessionRequest { + +// Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. +func (r FrontendApiDisableMySessionRequest) Cookie(cookie string) FrontendApiDisableMySessionRequest { r.cookie = &cookie return r } -func (r FrontendApiApiDisableMySessionRequest) Execute() (*http.Response, error) { +func (r FrontendApiDisableMySessionRequest) Execute() (*http.Response, error) { return r.ApiService.DisableMySessionExecute(r) } /* - - DisableMySession Disable one of my sessions - - Calling this endpoint invalidates the specified session. The current session cannot be revoked. +DisableMySession Disable one of my sessions +Calling this endpoint invalidates the specified session. The current session cannot be revoked. Session data are not deleted. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID is the session's ID. - - @return FrontendApiApiDisableMySessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return FrontendApiDisableMySessionRequest */ -func (a *FrontendApiService) DisableMySession(ctx context.Context, id string) FrontendApiApiDisableMySessionRequest { - return FrontendApiApiDisableMySessionRequest{ +func (a *FrontendApiService) DisableMySession(ctx context.Context, id string) FrontendApiDisableMySessionRequest { + return FrontendApiDisableMySessionRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - */ -func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySessionRequest) (*http.Response, error) { +// Execute executes the request +func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiDisableMySessionRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.DisableMySession") @@ -2831,7 +2875,7 @@ func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySe } localVarPath := localBasePath + "/sessions/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2855,12 +2899,12 @@ func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -2889,6 +2933,7 @@ func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySe newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -2899,6 +2944,7 @@ func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySe newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -2908,6 +2954,7 @@ func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySe newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -2915,50 +2962,51 @@ func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySe return localVarHTTPResponse, nil } -type FrontendApiApiExchangeSessionTokenRequest struct { +type FrontendApiExchangeSessionTokenRequest struct { ctx context.Context ApiService FrontendApi initCode *string returnToCode *string } -func (r FrontendApiApiExchangeSessionTokenRequest) InitCode(initCode string) FrontendApiApiExchangeSessionTokenRequest { +// The part of the code return when initializing the flow. +func (r FrontendApiExchangeSessionTokenRequest) InitCode(initCode string) FrontendApiExchangeSessionTokenRequest { r.initCode = &initCode return r } -func (r FrontendApiApiExchangeSessionTokenRequest) ReturnToCode(returnToCode string) FrontendApiApiExchangeSessionTokenRequest { + +// The part of the code returned by the return_to URL. +func (r FrontendApiExchangeSessionTokenRequest) ReturnToCode(returnToCode string) FrontendApiExchangeSessionTokenRequest { r.returnToCode = &returnToCode return r } -func (r FrontendApiApiExchangeSessionTokenRequest) Execute() (*SuccessfulNativeLogin, *http.Response, error) { +func (r FrontendApiExchangeSessionTokenRequest) Execute() (*SuccessfulNativeLogin, *http.Response, error) { return r.ApiService.ExchangeSessionTokenExecute(r) } /* - * ExchangeSessionToken Exchange Session Token - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiExchangeSessionTokenRequest - */ -func (a *FrontendApiService) ExchangeSessionToken(ctx context.Context) FrontendApiApiExchangeSessionTokenRequest { - return FrontendApiApiExchangeSessionTokenRequest{ +ExchangeSessionToken Exchange Session Token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiExchangeSessionTokenRequest +*/ +func (a *FrontendApiService) ExchangeSessionToken(ctx context.Context) FrontendApiExchangeSessionTokenRequest { + return FrontendApiExchangeSessionTokenRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SuccessfulNativeLogin - */ -func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchangeSessionTokenRequest) (*SuccessfulNativeLogin, *http.Response, error) { +// Execute executes the request +// +// @return SuccessfulNativeLogin +func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiExchangeSessionTokenRequest) (*SuccessfulNativeLogin, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SuccessfulNativeLogin + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SuccessfulNativeLogin ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.ExchangeSessionToken") @@ -2978,8 +3026,8 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang return localVarReturnValue, nil, reportError("returnToCode is required and must be specified") } - localVarQueryParams.Add("init_code", parameterToString(*r.initCode, "")) - localVarQueryParams.Add("return_to_code", parameterToString(*r.returnToCode, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "init_code", r.initCode, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to_code", r.returnToCode, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2997,7 +3045,7 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3026,6 +3074,7 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3036,6 +3085,7 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3046,6 +3096,7 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3055,6 +3106,7 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3071,52 +3123,52 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetFlowErrorRequest struct { +type FrontendApiGetFlowErrorRequest struct { ctx context.Context ApiService FrontendApi id *string } -func (r FrontendApiApiGetFlowErrorRequest) Id(id string) FrontendApiApiGetFlowErrorRequest { +// Error is the error's ID +func (r FrontendApiGetFlowErrorRequest) Id(id string) FrontendApiGetFlowErrorRequest { r.id = &id return r } -func (r FrontendApiApiGetFlowErrorRequest) Execute() (*FlowError, *http.Response, error) { +func (r FrontendApiGetFlowErrorRequest) Execute() (*FlowError, *http.Response, error) { return r.ApiService.GetFlowErrorExecute(r) } /* - - GetFlowError Get User-Flow Errors - - This endpoint returns the error associated with a user-facing self service errors. +GetFlowError Get User-Flow Errors + +This endpoint returns the error associated with a user-facing self service errors. This endpoint supports stub values to help you implement the error UI: `?id=stub:500` - returns a stub 500 (Internal Server Error) error. More information can be found at [Ory Kratos User User Facing Error Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-facing-errors). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetFlowErrorRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetFlowErrorRequest */ -func (a *FrontendApiService) GetFlowError(ctx context.Context) FrontendApiApiGetFlowErrorRequest { - return FrontendApiApiGetFlowErrorRequest{ +func (a *FrontendApiService) GetFlowError(ctx context.Context) FrontendApiGetFlowErrorRequest { + return FrontendApiGetFlowErrorRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return FlowError - */ -func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorRequest) (*FlowError, *http.Response, error) { +// Execute executes the request +// +// @return FlowError +func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiGetFlowErrorRequest) (*FlowError, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *FlowError + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FlowError ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetFlowError") @@ -3133,7 +3185,7 @@ func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorReq return localVarReturnValue, nil, reportError("id is required and must be specified") } - localVarQueryParams.Add("id", parameterToString(*r.id, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "id", r.id, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -3151,7 +3203,7 @@ func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorReq if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3180,6 +3232,7 @@ func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3190,6 +3243,7 @@ func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3200,6 +3254,7 @@ func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr @@ -3217,29 +3272,33 @@ func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorReq return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetLoginFlowRequest struct { +type FrontendApiGetLoginFlowRequest struct { ctx context.Context ApiService FrontendApi id *string cookie *string } -func (r FrontendApiApiGetLoginFlowRequest) Id(id string) FrontendApiApiGetLoginFlowRequest { +// The Login Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/login?flow=abcde`). +func (r FrontendApiGetLoginFlowRequest) Id(id string) FrontendApiGetLoginFlowRequest { r.id = &id return r } -func (r FrontendApiApiGetLoginFlowRequest) Cookie(cookie string) FrontendApiApiGetLoginFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiGetLoginFlowRequest) Cookie(cookie string) FrontendApiGetLoginFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiGetLoginFlowRequest) Execute() (*LoginFlow, *http.Response, error) { +func (r FrontendApiGetLoginFlowRequest) Execute() (*LoginFlow, *http.Response, error) { return r.ApiService.GetLoginFlowExecute(r) } /* - - GetLoginFlow Get Login Flow - - This endpoint returns a login flow's context with, for example, error details and other information. +GetLoginFlow Get Login Flow + +This endpoint returns a login flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -3262,28 +3321,26 @@ This request may fail due to several reasons. The `error.id` can be one of: `self_service_flow_expired`: The flow is expired and you should request a new one. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetLoginFlowRequest */ -func (a *FrontendApiService) GetLoginFlow(ctx context.Context) FrontendApiApiGetLoginFlowRequest { - return FrontendApiApiGetLoginFlowRequest{ +func (a *FrontendApiService) GetLoginFlow(ctx context.Context) FrontendApiGetLoginFlowRequest { + return FrontendApiGetLoginFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return LoginFlow - */ -func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowRequest) (*LoginFlow, *http.Response, error) { +// Execute executes the request +// +// @return LoginFlow +func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiGetLoginFlowRequest) (*LoginFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *LoginFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LoginFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetLoginFlow") @@ -3300,7 +3357,7 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq return localVarReturnValue, nil, reportError("id is required and must be specified") } - localVarQueryParams.Add("id", parameterToString(*r.id, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "id", r.id, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -3319,9 +3376,9 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3350,6 +3407,7 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3360,6 +3418,7 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3370,6 +3429,7 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3379,6 +3439,7 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3395,29 +3456,33 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetRecoveryFlowRequest struct { +type FrontendApiGetRecoveryFlowRequest struct { ctx context.Context ApiService FrontendApi id *string cookie *string } -func (r FrontendApiApiGetRecoveryFlowRequest) Id(id string) FrontendApiApiGetRecoveryFlowRequest { +// The Flow ID The value for this parameter comes from `request` URL Query parameter sent to your application (e.g. `/recovery?flow=abcde`). +func (r FrontendApiGetRecoveryFlowRequest) Id(id string) FrontendApiGetRecoveryFlowRequest { r.id = &id return r } -func (r FrontendApiApiGetRecoveryFlowRequest) Cookie(cookie string) FrontendApiApiGetRecoveryFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiGetRecoveryFlowRequest) Cookie(cookie string) FrontendApiGetRecoveryFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiGetRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { +func (r FrontendApiGetRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { return r.ApiService.GetRecoveryFlowExecute(r) } /* - - GetRecoveryFlow Get Recovery Flow - - This endpoint returns a recovery flow's context with, for example, error details and other information. +GetRecoveryFlow Get Recovery Flow + +This endpoint returns a recovery flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -3435,28 +3500,26 @@ res.render('recovery', flow) ``` More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetRecoveryFlowRequest */ -func (a *FrontendApiService) GetRecoveryFlow(ctx context.Context) FrontendApiApiGetRecoveryFlowRequest { - return FrontendApiApiGetRecoveryFlowRequest{ +func (a *FrontendApiService) GetRecoveryFlow(ctx context.Context) FrontendApiGetRecoveryFlowRequest { + return FrontendApiGetRecoveryFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RecoveryFlow - */ -func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { +// Execute executes the request +// +// @return RecoveryFlow +func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiGetRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RecoveryFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetRecoveryFlow") @@ -3473,7 +3536,7 @@ func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryF return localVarReturnValue, nil, reportError("id is required and must be specified") } - localVarQueryParams.Add("id", parameterToString(*r.id, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "id", r.id, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -3492,9 +3555,9 @@ func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryF localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3523,6 +3586,7 @@ func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3533,6 +3597,7 @@ func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3542,6 +3607,7 @@ func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3558,29 +3624,33 @@ func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryF return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetRegistrationFlowRequest struct { +type FrontendApiGetRegistrationFlowRequest struct { ctx context.Context ApiService FrontendApi id *string cookie *string } -func (r FrontendApiApiGetRegistrationFlowRequest) Id(id string) FrontendApiApiGetRegistrationFlowRequest { +// The Registration Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/registration?flow=abcde`). +func (r FrontendApiGetRegistrationFlowRequest) Id(id string) FrontendApiGetRegistrationFlowRequest { r.id = &id return r } -func (r FrontendApiApiGetRegistrationFlowRequest) Cookie(cookie string) FrontendApiApiGetRegistrationFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiGetRegistrationFlowRequest) Cookie(cookie string) FrontendApiGetRegistrationFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiGetRegistrationFlowRequest) Execute() (*RegistrationFlow, *http.Response, error) { +func (r FrontendApiGetRegistrationFlowRequest) Execute() (*RegistrationFlow, *http.Response, error) { return r.ApiService.GetRegistrationFlowExecute(r) } /* - - GetRegistrationFlow Get Registration Flow - - This endpoint returns a registration flow's context with, for example, error details and other information. +GetRegistrationFlow Get Registration Flow + +This endpoint returns a registration flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -3603,28 +3673,26 @@ This request may fail due to several reasons. The `error.id` can be one of: `self_service_flow_expired`: The flow is expired and you should request a new one. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetRegistrationFlowRequest */ -func (a *FrontendApiService) GetRegistrationFlow(ctx context.Context) FrontendApiApiGetRegistrationFlowRequest { - return FrontendApiApiGetRegistrationFlowRequest{ +func (a *FrontendApiService) GetRegistrationFlow(ctx context.Context) FrontendApiGetRegistrationFlowRequest { + return FrontendApiGetRegistrationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RegistrationFlow - */ -func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) { +// Execute executes the request +// +// @return RegistrationFlow +func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiGetRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RegistrationFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegistrationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetRegistrationFlow") @@ -3641,7 +3709,7 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis return localVarReturnValue, nil, reportError("id is required and must be specified") } - localVarQueryParams.Add("id", parameterToString(*r.id, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "id", r.id, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -3660,9 +3728,9 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3691,6 +3759,7 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3701,6 +3770,7 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3711,6 +3781,7 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3720,6 +3791,7 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3736,7 +3808,7 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetSettingsFlowRequest struct { +type FrontendApiGetSettingsFlowRequest struct { ctx context.Context ApiService FrontendApi id *string @@ -3744,27 +3816,32 @@ type FrontendApiApiGetSettingsFlowRequest struct { cookie *string } -func (r FrontendApiApiGetSettingsFlowRequest) Id(id string) FrontendApiApiGetSettingsFlowRequest { +// ID is the Settings Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/settings?flow=abcde`). +func (r FrontendApiGetSettingsFlowRequest) Id(id string) FrontendApiGetSettingsFlowRequest { r.id = &id return r } -func (r FrontendApiApiGetSettingsFlowRequest) XSessionToken(xSessionToken string) FrontendApiApiGetSettingsFlowRequest { + +// The Session Token When using the SDK in an app without a browser, please include the session token here. +func (r FrontendApiGetSettingsFlowRequest) XSessionToken(xSessionToken string) FrontendApiGetSettingsFlowRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiGetSettingsFlowRequest) Cookie(cookie string) FrontendApiApiGetSettingsFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiGetSettingsFlowRequest) Cookie(cookie string) FrontendApiGetSettingsFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiGetSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { +func (r FrontendApiGetSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { return r.ApiService.GetSettingsFlowExecute(r) } /* - - GetSettingsFlow Get Settings Flow - - When accessing this endpoint through Ory Kratos' Public API you must ensure that either the Ory Kratos Session Cookie +GetSettingsFlow Get Settings Flow +When accessing this endpoint through Ory Kratos' Public API you must ensure that either the Ory Kratos Session Cookie or the Ory Kratos Session Token are set. Depending on your configuration this endpoint might return a 403 error if the session has a lower Authenticator @@ -3783,28 +3860,26 @@ case of an error, the `error.id` of the JSON response body can be one of: identity logged in instead. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetSettingsFlowRequest */ -func (a *FrontendApiService) GetSettingsFlow(ctx context.Context) FrontendApiApiGetSettingsFlowRequest { - return FrontendApiApiGetSettingsFlowRequest{ +func (a *FrontendApiService) GetSettingsFlow(ctx context.Context) FrontendApiGetSettingsFlowRequest { + return FrontendApiGetSettingsFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SettingsFlow - */ -func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { +// Execute executes the request +// +// @return SettingsFlow +func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiGetSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SettingsFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SettingsFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetSettingsFlow") @@ -3821,7 +3896,7 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF return localVarReturnValue, nil, reportError("id is required and must be specified") } - localVarQueryParams.Add("id", parameterToString(*r.id, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "id", r.id, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -3840,12 +3915,12 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3874,6 +3949,7 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3884,6 +3960,7 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3894,6 +3971,7 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3904,6 +3982,7 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3913,6 +3992,7 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3929,29 +4009,33 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetVerificationFlowRequest struct { +type FrontendApiGetVerificationFlowRequest struct { ctx context.Context ApiService FrontendApi id *string cookie *string } -func (r FrontendApiApiGetVerificationFlowRequest) Id(id string) FrontendApiApiGetVerificationFlowRequest { +// The Flow ID The value for this parameter comes from `request` URL Query parameter sent to your application (e.g. `/verification?flow=abcde`). +func (r FrontendApiGetVerificationFlowRequest) Id(id string) FrontendApiGetVerificationFlowRequest { r.id = &id return r } -func (r FrontendApiApiGetVerificationFlowRequest) Cookie(cookie string) FrontendApiApiGetVerificationFlowRequest { + +// HTTP Cookies When using the SDK on the server side you must include the HTTP Cookie Header originally sent to your HTTP handler here. +func (r FrontendApiGetVerificationFlowRequest) Cookie(cookie string) FrontendApiGetVerificationFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiGetVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { +func (r FrontendApiGetVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { return r.ApiService.GetVerificationFlowExecute(r) } /* - - GetVerificationFlow Get Verification Flow - - This endpoint returns a verification flow's context with, for example, error details and other information. +GetVerificationFlow Get Verification Flow + +This endpoint returns a verification flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -3969,28 +4053,26 @@ res.render('verification', flow) ``` More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetVerificationFlowRequest */ -func (a *FrontendApiService) GetVerificationFlow(ctx context.Context) FrontendApiApiGetVerificationFlowRequest { - return FrontendApiApiGetVerificationFlowRequest{ +func (a *FrontendApiService) GetVerificationFlow(ctx context.Context) FrontendApiGetVerificationFlowRequest { + return FrontendApiGetVerificationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return VerificationFlow - */ -func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { +// Execute executes the request +// +// @return VerificationFlow +func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiGetVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *VerificationFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VerificationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetVerificationFlow") @@ -4007,7 +4089,7 @@ func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerif return localVarReturnValue, nil, reportError("id is required and must be specified") } - localVarQueryParams.Add("id", parameterToString(*r.id, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "id", r.id, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -4026,9 +4108,9 @@ func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerif localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -4057,6 +4139,7 @@ func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerif newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4067,6 +4150,7 @@ func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerif newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4076,6 +4160,7 @@ func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerif newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4092,18 +4177,19 @@ func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerif return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetWebAuthnJavaScriptRequest struct { +type FrontendApiGetWebAuthnJavaScriptRequest struct { ctx context.Context ApiService FrontendApi } -func (r FrontendApiApiGetWebAuthnJavaScriptRequest) Execute() (string, *http.Response, error) { +func (r FrontendApiGetWebAuthnJavaScriptRequest) Execute() (string, *http.Response, error) { return r.ApiService.GetWebAuthnJavaScriptExecute(r) } /* - - GetWebAuthnJavaScript Get WebAuthn JavaScript - - This endpoint provides JavaScript which is needed in order to perform WebAuthn login and registration. +GetWebAuthnJavaScript Get WebAuthn JavaScript + +This endpoint provides JavaScript which is needed in order to perform WebAuthn login and registration. If you are building a JavaScript Browser App (e.g. in ReactJS or AngularJS) you will need to load this file: @@ -4112,28 +4198,26 @@ If you are building a JavaScript Browser App (e.g. in ReactJS or AngularJS) you ``` More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetWebAuthnJavaScriptRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetWebAuthnJavaScriptRequest */ -func (a *FrontendApiService) GetWebAuthnJavaScript(ctx context.Context) FrontendApiApiGetWebAuthnJavaScriptRequest { - return FrontendApiApiGetWebAuthnJavaScriptRequest{ +func (a *FrontendApiService) GetWebAuthnJavaScript(ctx context.Context) FrontendApiGetWebAuthnJavaScriptRequest { + return FrontendApiGetWebAuthnJavaScriptRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return string - */ -func (a *FrontendApiService) GetWebAuthnJavaScriptExecute(r FrontendApiApiGetWebAuthnJavaScriptRequest) (string, *http.Response, error) { +// Execute executes the request +// +// @return string +func (a *FrontendApiService) GetWebAuthnJavaScriptExecute(r FrontendApiGetWebAuthnJavaScriptRequest) (string, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue string + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetWebAuthnJavaScript") @@ -4164,7 +4248,7 @@ func (a *FrontendApiService) GetWebAuthnJavaScriptExecute(r FrontendApiApiGetWeb if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -4201,7 +4285,7 @@ func (a *FrontendApiService) GetWebAuthnJavaScriptExecute(r FrontendApiApiGetWeb return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiListMySessionsRequest struct { +type FrontendApiListMySessionsRequest struct { ctx context.Context ApiService FrontendApi perPage *int64 @@ -4212,62 +4296,71 @@ type FrontendApiApiListMySessionsRequest struct { cookie *string } -func (r FrontendApiApiListMySessionsRequest) PerPage(perPage int64) FrontendApiApiListMySessionsRequest { +// Deprecated Items per Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This is the number of items per page. +func (r FrontendApiListMySessionsRequest) PerPage(perPage int64) FrontendApiListMySessionsRequest { r.perPage = &perPage return r } -func (r FrontendApiApiListMySessionsRequest) Page(page int64) FrontendApiApiListMySessionsRequest { + +// Deprecated Pagination Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the `Link` header. +func (r FrontendApiListMySessionsRequest) Page(page int64) FrontendApiListMySessionsRequest { r.page = &page return r } -func (r FrontendApiApiListMySessionsRequest) PageSize(pageSize int64) FrontendApiApiListMySessionsRequest { + +// Page Size This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r FrontendApiListMySessionsRequest) PageSize(pageSize int64) FrontendApiListMySessionsRequest { r.pageSize = &pageSize return r } -func (r FrontendApiApiListMySessionsRequest) PageToken(pageToken string) FrontendApiApiListMySessionsRequest { + +// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r FrontendApiListMySessionsRequest) PageToken(pageToken string) FrontendApiListMySessionsRequest { r.pageToken = &pageToken return r } -func (r FrontendApiApiListMySessionsRequest) XSessionToken(xSessionToken string) FrontendApiApiListMySessionsRequest { + +// Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. +func (r FrontendApiListMySessionsRequest) XSessionToken(xSessionToken string) FrontendApiListMySessionsRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiListMySessionsRequest) Cookie(cookie string) FrontendApiApiListMySessionsRequest { + +// Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. +func (r FrontendApiListMySessionsRequest) Cookie(cookie string) FrontendApiListMySessionsRequest { r.cookie = &cookie return r } -func (r FrontendApiApiListMySessionsRequest) Execute() ([]Session, *http.Response, error) { +func (r FrontendApiListMySessionsRequest) Execute() ([]Session, *http.Response, error) { return r.ApiService.ListMySessionsExecute(r) } /* - - ListMySessions Get My Active Sessions - - This endpoints returns all other active sessions that belong to the logged-in user. +ListMySessions Get My Active Sessions +This endpoints returns all other active sessions that belong to the logged-in user. The current session can be retrieved by calling the `/sessions/whoami` endpoint. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiListMySessionsRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiListMySessionsRequest */ -func (a *FrontendApiService) ListMySessions(ctx context.Context) FrontendApiApiListMySessionsRequest { - return FrontendApiApiListMySessionsRequest{ +func (a *FrontendApiService) ListMySessions(ctx context.Context) FrontendApiListMySessionsRequest { + return FrontendApiListMySessionsRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return []Session - */ -func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySessionsRequest) ([]Session, *http.Response, error) { +// Execute executes the request +// +// @return []Session +func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiListMySessionsRequest) ([]Session, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []Session + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Session ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.ListMySessions") @@ -4282,16 +4375,25 @@ func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySession localVarFormParams := url.Values{} if r.perPage != nil { - localVarQueryParams.Add("per_page", parameterToString(*r.perPage, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } else { + var defaultValue int64 = 250 + r.perPage = &defaultValue } if r.page != nil { - localVarQueryParams.Add("page", parameterToString(*r.page, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") } if r.pageSize != nil { - localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "") + } else { + var defaultValue int64 = 250 + r.pageSize = &defaultValue } if r.pageToken != nil { - localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "") + } else { + var defaultValue string = "1" + r.pageToken = &defaultValue } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -4311,12 +4413,12 @@ func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySession localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -4345,6 +4447,7 @@ func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySession newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4355,6 +4458,7 @@ func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySession newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4364,6 +4468,7 @@ func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySession newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4380,25 +4485,25 @@ func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySession return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiPerformNativeLogoutRequest struct { +type FrontendApiPerformNativeLogoutRequest struct { ctx context.Context ApiService FrontendApi performNativeLogoutBody *PerformNativeLogoutBody } -func (r FrontendApiApiPerformNativeLogoutRequest) PerformNativeLogoutBody(performNativeLogoutBody PerformNativeLogoutBody) FrontendApiApiPerformNativeLogoutRequest { +func (r FrontendApiPerformNativeLogoutRequest) PerformNativeLogoutBody(performNativeLogoutBody PerformNativeLogoutBody) FrontendApiPerformNativeLogoutRequest { r.performNativeLogoutBody = &performNativeLogoutBody return r } -func (r FrontendApiApiPerformNativeLogoutRequest) Execute() (*http.Response, error) { +func (r FrontendApiPerformNativeLogoutRequest) Execute() (*http.Response, error) { return r.ApiService.PerformNativeLogoutExecute(r) } /* - - PerformNativeLogout Perform Logout for Native Apps - - Use this endpoint to log out an identity using an Ory Session Token. If the Ory Session Token was successfully +PerformNativeLogout Perform Logout for Native Apps +Use this endpoint to log out an identity using an Ory Session Token. If the Ory Session Token was successfully revoked, the server returns a 204 No Content response. A 204 No Content response is also sent when the Ory Session Token has been revoked already before. @@ -4406,26 +4511,23 @@ If the Ory Session Token is malformed or does not exist a 403 Forbidden response This endpoint does not remove any HTTP Cookies - use the Browser-Based Self-Service Logout Flow instead. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiPerformNativeLogoutRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiPerformNativeLogoutRequest */ -func (a *FrontendApiService) PerformNativeLogout(ctx context.Context) FrontendApiApiPerformNativeLogoutRequest { - return FrontendApiApiPerformNativeLogoutRequest{ +func (a *FrontendApiService) PerformNativeLogout(ctx context.Context) FrontendApiPerformNativeLogoutRequest { + return FrontendApiPerformNativeLogoutRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - */ -func (a *FrontendApiService) PerformNativeLogoutExecute(r FrontendApiApiPerformNativeLogoutRequest) (*http.Response, error) { +// Execute executes the request +func (a *FrontendApiService) PerformNativeLogoutExecute(r FrontendApiPerformNativeLogoutRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.PerformNativeLogout") @@ -4461,7 +4563,7 @@ func (a *FrontendApiService) PerformNativeLogoutExecute(r FrontendApiApiPerformN } // body params localVarPostBody = r.performNativeLogoutBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -4490,6 +4592,7 @@ func (a *FrontendApiService) PerformNativeLogoutExecute(r FrontendApiApiPerformN newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -4499,6 +4602,7 @@ func (a *FrontendApiService) PerformNativeLogoutExecute(r FrontendApiApiPerformN newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -4506,7 +4610,7 @@ func (a *FrontendApiService) PerformNativeLogoutExecute(r FrontendApiApiPerformN return localVarHTTPResponse, nil } -type FrontendApiApiToSessionRequest struct { +type FrontendApiToSessionRequest struct { ctx context.Context ApiService FrontendApi xSessionToken *string @@ -4514,27 +4618,32 @@ type FrontendApiApiToSessionRequest struct { tokenizeAs *string } -func (r FrontendApiApiToSessionRequest) XSessionToken(xSessionToken string) FrontendApiApiToSessionRequest { +// Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. +func (r FrontendApiToSessionRequest) XSessionToken(xSessionToken string) FrontendApiToSessionRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiToSessionRequest) Cookie(cookie string) FrontendApiApiToSessionRequest { + +// Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. +func (r FrontendApiToSessionRequest) Cookie(cookie string) FrontendApiToSessionRequest { r.cookie = &cookie return r } -func (r FrontendApiApiToSessionRequest) TokenizeAs(tokenizeAs string) FrontendApiApiToSessionRequest { + +// Returns the session additionally as a token (such as a JWT) The value of this parameter has to be a valid, configured Ory Session token template. For more information head over to [the documentation](http://ory.sh/docs/identities/session-to-jwt-cors). +func (r FrontendApiToSessionRequest) TokenizeAs(tokenizeAs string) FrontendApiToSessionRequest { r.tokenizeAs = &tokenizeAs return r } -func (r FrontendApiApiToSessionRequest) Execute() (*Session, *http.Response, error) { +func (r FrontendApiToSessionRequest) Execute() (*Session, *http.Response, error) { return r.ApiService.ToSessionExecute(r) } /* - - ToSession Check Who the Current HTTP Session Belongs To - - Uses the HTTP Headers in the GET request to determine (e.g. by using checking the cookies) who is authenticated. +ToSession Check Who the Current HTTP Session Belongs To +Uses the HTTP Headers in the GET request to determine (e.g. by using checking the cookies) who is authenticated. Returns a session object in the body or 401 if the credentials are invalid or no credentials were sent. When the request it successful it adds the user ID to the 'X-Kratos-Authenticated-Identity-Id' header in the response. @@ -4593,28 +4702,26 @@ As explained above, this request may fail due to several reasons. The `error.id` `session_inactive`: No active session was found in the request (e.g. no Ory Session Cookie / Ory Session Token). `session_aal2_required`: An active session was found but it does not fulfil the Authenticator Assurance Level, implying that the session must (e.g.) authenticate the second factor. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiToSessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiToSessionRequest */ -func (a *FrontendApiService) ToSession(ctx context.Context) FrontendApiApiToSessionRequest { - return FrontendApiApiToSessionRequest{ +func (a *FrontendApiService) ToSession(ctx context.Context) FrontendApiToSessionRequest { + return FrontendApiToSessionRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return Session - */ -func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) (*Session, *http.Response, error) { +// Execute executes the request +// +// @return Session +func (a *FrontendApiService) ToSessionExecute(r FrontendApiToSessionRequest) (*Session, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Session + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Session ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.ToSession") @@ -4629,7 +4736,7 @@ func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) localVarFormParams := url.Values{} if r.tokenizeAs != nil { - localVarQueryParams.Add("tokenize_as", parameterToString(*r.tokenizeAs, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "tokenize_as", r.tokenizeAs, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -4649,12 +4756,12 @@ func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -4683,6 +4790,7 @@ func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4693,6 +4801,7 @@ func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4702,6 +4811,7 @@ func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4718,7 +4828,7 @@ func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiUpdateLoginFlowRequest struct { +type FrontendApiUpdateLoginFlowRequest struct { ctx context.Context ApiService FrontendApi flow *string @@ -4727,31 +4837,37 @@ type FrontendApiApiUpdateLoginFlowRequest struct { cookie *string } -func (r FrontendApiApiUpdateLoginFlowRequest) Flow(flow string) FrontendApiApiUpdateLoginFlowRequest { +// The Login Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/login?flow=abcde`). +func (r FrontendApiUpdateLoginFlowRequest) Flow(flow string) FrontendApiUpdateLoginFlowRequest { r.flow = &flow return r } -func (r FrontendApiApiUpdateLoginFlowRequest) UpdateLoginFlowBody(updateLoginFlowBody UpdateLoginFlowBody) FrontendApiApiUpdateLoginFlowRequest { + +func (r FrontendApiUpdateLoginFlowRequest) UpdateLoginFlowBody(updateLoginFlowBody UpdateLoginFlowBody) FrontendApiUpdateLoginFlowRequest { r.updateLoginFlowBody = &updateLoginFlowBody return r } -func (r FrontendApiApiUpdateLoginFlowRequest) XSessionToken(xSessionToken string) FrontendApiApiUpdateLoginFlowRequest { + +// The Session Token of the Identity performing the settings flow. +func (r FrontendApiUpdateLoginFlowRequest) XSessionToken(xSessionToken string) FrontendApiUpdateLoginFlowRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiUpdateLoginFlowRequest) Cookie(cookie string) FrontendApiApiUpdateLoginFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiUpdateLoginFlowRequest) Cookie(cookie string) FrontendApiUpdateLoginFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiUpdateLoginFlowRequest) Execute() (*SuccessfulNativeLogin, *http.Response, error) { +func (r FrontendApiUpdateLoginFlowRequest) Execute() (*SuccessfulNativeLogin, *http.Response, error) { return r.ApiService.UpdateLoginFlowExecute(r) } /* - - UpdateLoginFlow Submit a Login Flow - - Use this endpoint to complete a login flow. This endpoint +UpdateLoginFlow Submit a Login Flow +Use this endpoint to complete a login flow. This endpoint behaves differently for API and browser flows. API flows expect `application/json` to be sent in the body and responds with @@ -4778,28 +4894,26 @@ case of an error, the `error.id` of the JSON response body can be one of: Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiUpdateLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateLoginFlowRequest */ -func (a *FrontendApiService) UpdateLoginFlow(ctx context.Context) FrontendApiApiUpdateLoginFlowRequest { - return FrontendApiApiUpdateLoginFlowRequest{ +func (a *FrontendApiService) UpdateLoginFlow(ctx context.Context) FrontendApiUpdateLoginFlowRequest { + return FrontendApiUpdateLoginFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SuccessfulNativeLogin - */ -func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginFlowRequest) (*SuccessfulNativeLogin, *http.Response, error) { +// Execute executes the request +// +// @return SuccessfulNativeLogin +func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiUpdateLoginFlowRequest) (*SuccessfulNativeLogin, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SuccessfulNativeLogin + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SuccessfulNativeLogin ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.UpdateLoginFlow") @@ -4819,7 +4933,7 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF return localVarReturnValue, nil, reportError("updateLoginFlowBody is required and must be specified") } - localVarQueryParams.Add("flow", parameterToString(*r.flow, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "flow", r.flow, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} @@ -4838,14 +4952,14 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } // body params localVarPostBody = r.updateLoginFlowBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -4874,6 +4988,7 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4884,6 +4999,7 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4894,6 +5010,7 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4903,6 +5020,7 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4919,7 +5037,7 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiUpdateLogoutFlowRequest struct { +type FrontendApiUpdateLogoutFlowRequest struct { ctx context.Context ApiService FrontendApi token *string @@ -4927,26 +5045,32 @@ type FrontendApiApiUpdateLogoutFlowRequest struct { cookie *string } -func (r FrontendApiApiUpdateLogoutFlowRequest) Token(token string) FrontendApiApiUpdateLogoutFlowRequest { +// A Valid Logout Token If you do not have a logout token because you only have a session cookie, call `/self-service/logout/browser` to generate a URL for this endpoint. +func (r FrontendApiUpdateLogoutFlowRequest) Token(token string) FrontendApiUpdateLogoutFlowRequest { r.token = &token return r } -func (r FrontendApiApiUpdateLogoutFlowRequest) ReturnTo(returnTo string) FrontendApiApiUpdateLogoutFlowRequest { + +// The URL to return to after the logout was completed. +func (r FrontendApiUpdateLogoutFlowRequest) ReturnTo(returnTo string) FrontendApiUpdateLogoutFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiUpdateLogoutFlowRequest) Cookie(cookie string) FrontendApiApiUpdateLogoutFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiUpdateLogoutFlowRequest) Cookie(cookie string) FrontendApiUpdateLogoutFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiUpdateLogoutFlowRequest) Execute() (*http.Response, error) { +func (r FrontendApiUpdateLogoutFlowRequest) Execute() (*http.Response, error) { return r.ApiService.UpdateLogoutFlowExecute(r) } /* - - UpdateLogoutFlow Update Logout Flow - - This endpoint logs out an identity in a self-service manner. +UpdateLogoutFlow Update Logout Flow + +This endpoint logs out an identity in a self-service manner. If the `Accept` HTTP header is not set to `application/json`, the browser will be redirected (HTTP 303 See Other) to the `return_to` parameter of the initial request or fall back to `urls.default_return_to`. @@ -4959,26 +5083,23 @@ with browsers (Chrome, Firefox, ...). For API clients you can call the `/self-service/logout/api` URL directly with the Ory Session Token. More information can be found at [Ory Kratos User Logout Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-logout). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiUpdateLogoutFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateLogoutFlowRequest */ -func (a *FrontendApiService) UpdateLogoutFlow(ctx context.Context) FrontendApiApiUpdateLogoutFlowRequest { - return FrontendApiApiUpdateLogoutFlowRequest{ +func (a *FrontendApiService) UpdateLogoutFlow(ctx context.Context) FrontendApiUpdateLogoutFlowRequest { + return FrontendApiUpdateLogoutFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - */ -func (a *FrontendApiService) UpdateLogoutFlowExecute(r FrontendApiApiUpdateLogoutFlowRequest) (*http.Response, error) { +// Execute executes the request +func (a *FrontendApiService) UpdateLogoutFlowExecute(r FrontendApiUpdateLogoutFlowRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.UpdateLogoutFlow") @@ -4993,10 +5114,10 @@ func (a *FrontendApiService) UpdateLogoutFlowExecute(r FrontendApiApiUpdateLogou localVarFormParams := url.Values{} if r.token != nil { - localVarQueryParams.Add("token", parameterToString(*r.token, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "token", r.token, "") } if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -5016,9 +5137,9 @@ func (a *FrontendApiService) UpdateLogoutFlowExecute(r FrontendApiApiUpdateLogou localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -5046,6 +5167,7 @@ func (a *FrontendApiService) UpdateLogoutFlowExecute(r FrontendApiApiUpdateLogou newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -5053,7 +5175,7 @@ func (a *FrontendApiService) UpdateLogoutFlowExecute(r FrontendApiApiUpdateLogou return localVarHTTPResponse, nil } -type FrontendApiApiUpdateRecoveryFlowRequest struct { +type FrontendApiUpdateRecoveryFlowRequest struct { ctx context.Context ApiService FrontendApi flow *string @@ -5062,31 +5184,37 @@ type FrontendApiApiUpdateRecoveryFlowRequest struct { cookie *string } -func (r FrontendApiApiUpdateRecoveryFlowRequest) Flow(flow string) FrontendApiApiUpdateRecoveryFlowRequest { +// The Recovery Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/recovery?flow=abcde`). +func (r FrontendApiUpdateRecoveryFlowRequest) Flow(flow string) FrontendApiUpdateRecoveryFlowRequest { r.flow = &flow return r } -func (r FrontendApiApiUpdateRecoveryFlowRequest) UpdateRecoveryFlowBody(updateRecoveryFlowBody UpdateRecoveryFlowBody) FrontendApiApiUpdateRecoveryFlowRequest { + +func (r FrontendApiUpdateRecoveryFlowRequest) UpdateRecoveryFlowBody(updateRecoveryFlowBody UpdateRecoveryFlowBody) FrontendApiUpdateRecoveryFlowRequest { r.updateRecoveryFlowBody = &updateRecoveryFlowBody return r } -func (r FrontendApiApiUpdateRecoveryFlowRequest) Token(token string) FrontendApiApiUpdateRecoveryFlowRequest { + +// Recovery Token The recovery token which completes the recovery request. If the token is invalid (e.g. expired) an error will be shown to the end-user. This parameter is usually set in a link and not used by any direct API call. +func (r FrontendApiUpdateRecoveryFlowRequest) Token(token string) FrontendApiUpdateRecoveryFlowRequest { r.token = &token return r } -func (r FrontendApiApiUpdateRecoveryFlowRequest) Cookie(cookie string) FrontendApiApiUpdateRecoveryFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiUpdateRecoveryFlowRequest) Cookie(cookie string) FrontendApiUpdateRecoveryFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiUpdateRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { +func (r FrontendApiUpdateRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { return r.ApiService.UpdateRecoveryFlowExecute(r) } /* - - UpdateRecoveryFlow Update Recovery Flow - - Use this endpoint to update a recovery flow. This endpoint +UpdateRecoveryFlow Update Recovery Flow +Use this endpoint to update a recovery flow. This endpoint behaves differently for API and browser flows and has several states: `choose_method` expects `flow` (in the URL query) and `email` (in the body) to be sent @@ -5102,28 +5230,26 @@ does not have any API capabilities. The server responds with a HTTP 303 See Othe a new Recovery Flow ID which contains an error message that the recovery link was invalid. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiUpdateRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateRecoveryFlowRequest */ -func (a *FrontendApiService) UpdateRecoveryFlow(ctx context.Context) FrontendApiApiUpdateRecoveryFlowRequest { - return FrontendApiApiUpdateRecoveryFlowRequest{ +func (a *FrontendApiService) UpdateRecoveryFlow(ctx context.Context) FrontendApiUpdateRecoveryFlowRequest { + return FrontendApiUpdateRecoveryFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RecoveryFlow - */ -func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { +// Execute executes the request +// +// @return RecoveryFlow +func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiUpdateRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RecoveryFlow + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.UpdateRecoveryFlow") @@ -5143,9 +5269,9 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec return localVarReturnValue, nil, reportError("updateRecoveryFlowBody is required and must be specified") } - localVarQueryParams.Add("flow", parameterToString(*r.flow, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "flow", r.flow, "") if r.token != nil { - localVarQueryParams.Add("token", parameterToString(*r.token, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "token", r.token, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} @@ -5165,11 +5291,11 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } // body params localVarPostBody = r.updateRecoveryFlowBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -5198,6 +5324,7 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5208,6 +5335,7 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5218,6 +5346,7 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5227,6 +5356,7 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5243,7 +5373,7 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiUpdateRegistrationFlowRequest struct { +type FrontendApiUpdateRegistrationFlowRequest struct { ctx context.Context ApiService FrontendApi flow *string @@ -5251,27 +5381,31 @@ type FrontendApiApiUpdateRegistrationFlowRequest struct { cookie *string } -func (r FrontendApiApiUpdateRegistrationFlowRequest) Flow(flow string) FrontendApiApiUpdateRegistrationFlowRequest { +// The Registration Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/registration?flow=abcde`). +func (r FrontendApiUpdateRegistrationFlowRequest) Flow(flow string) FrontendApiUpdateRegistrationFlowRequest { r.flow = &flow return r } -func (r FrontendApiApiUpdateRegistrationFlowRequest) UpdateRegistrationFlowBody(updateRegistrationFlowBody UpdateRegistrationFlowBody) FrontendApiApiUpdateRegistrationFlowRequest { + +func (r FrontendApiUpdateRegistrationFlowRequest) UpdateRegistrationFlowBody(updateRegistrationFlowBody UpdateRegistrationFlowBody) FrontendApiUpdateRegistrationFlowRequest { r.updateRegistrationFlowBody = &updateRegistrationFlowBody return r } -func (r FrontendApiApiUpdateRegistrationFlowRequest) Cookie(cookie string) FrontendApiApiUpdateRegistrationFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiUpdateRegistrationFlowRequest) Cookie(cookie string) FrontendApiUpdateRegistrationFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiUpdateRegistrationFlowRequest) Execute() (*SuccessfulNativeRegistration, *http.Response, error) { +func (r FrontendApiUpdateRegistrationFlowRequest) Execute() (*SuccessfulNativeRegistration, *http.Response, error) { return r.ApiService.UpdateRegistrationFlowExecute(r) } /* - - UpdateRegistrationFlow Update Registration Flow - - Use this endpoint to complete a registration flow by sending an identity's traits and password. This endpoint +UpdateRegistrationFlow Update Registration Flow +Use this endpoint to complete a registration flow by sending an identity's traits and password. This endpoint behaves differently for API and browser flows. API flows expect `application/json` to be sent in the body and respond with @@ -5299,28 +5433,26 @@ case of an error, the `error.id` of the JSON response body can be one of: Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiUpdateRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateRegistrationFlowRequest */ -func (a *FrontendApiService) UpdateRegistrationFlow(ctx context.Context) FrontendApiApiUpdateRegistrationFlowRequest { - return FrontendApiApiUpdateRegistrationFlowRequest{ +func (a *FrontendApiService) UpdateRegistrationFlow(ctx context.Context) FrontendApiUpdateRegistrationFlowRequest { + return FrontendApiUpdateRegistrationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SuccessfulNativeRegistration - */ -func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdateRegistrationFlowRequest) (*SuccessfulNativeRegistration, *http.Response, error) { +// Execute executes the request +// +// @return SuccessfulNativeRegistration +func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiUpdateRegistrationFlowRequest) (*SuccessfulNativeRegistration, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SuccessfulNativeRegistration + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SuccessfulNativeRegistration ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.UpdateRegistrationFlow") @@ -5340,7 +5472,7 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat return localVarReturnValue, nil, reportError("updateRegistrationFlowBody is required and must be specified") } - localVarQueryParams.Add("flow", parameterToString(*r.flow, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "flow", r.flow, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} @@ -5359,11 +5491,11 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } // body params localVarPostBody = r.updateRegistrationFlowBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -5392,6 +5524,7 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5402,6 +5535,7 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5412,6 +5546,7 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5421,6 +5556,7 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5437,7 +5573,7 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiUpdateSettingsFlowRequest struct { +type FrontendApiUpdateSettingsFlowRequest struct { ctx context.Context ApiService FrontendApi flow *string @@ -5446,31 +5582,37 @@ type FrontendApiApiUpdateSettingsFlowRequest struct { cookie *string } -func (r FrontendApiApiUpdateSettingsFlowRequest) Flow(flow string) FrontendApiApiUpdateSettingsFlowRequest { +// The Settings Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/settings?flow=abcde`). +func (r FrontendApiUpdateSettingsFlowRequest) Flow(flow string) FrontendApiUpdateSettingsFlowRequest { r.flow = &flow return r } -func (r FrontendApiApiUpdateSettingsFlowRequest) UpdateSettingsFlowBody(updateSettingsFlowBody UpdateSettingsFlowBody) FrontendApiApiUpdateSettingsFlowRequest { + +func (r FrontendApiUpdateSettingsFlowRequest) UpdateSettingsFlowBody(updateSettingsFlowBody UpdateSettingsFlowBody) FrontendApiUpdateSettingsFlowRequest { r.updateSettingsFlowBody = &updateSettingsFlowBody return r } -func (r FrontendApiApiUpdateSettingsFlowRequest) XSessionToken(xSessionToken string) FrontendApiApiUpdateSettingsFlowRequest { + +// The Session Token of the Identity performing the settings flow. +func (r FrontendApiUpdateSettingsFlowRequest) XSessionToken(xSessionToken string) FrontendApiUpdateSettingsFlowRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiUpdateSettingsFlowRequest) Cookie(cookie string) FrontendApiApiUpdateSettingsFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiUpdateSettingsFlowRequest) Cookie(cookie string) FrontendApiUpdateSettingsFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiUpdateSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { +func (r FrontendApiUpdateSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { return r.ApiService.UpdateSettingsFlowExecute(r) } /* - - UpdateSettingsFlow Complete Settings Flow - - Use this endpoint to complete a settings flow by sending an identity's updated password. This endpoint +UpdateSettingsFlow Complete Settings Flow +Use this endpoint to complete a settings flow by sending an identity's updated password. This endpoint behaves differently for API and browser flows. API-initiated flows expect `application/json` to be sent in the body and respond with @@ -5513,28 +5655,26 @@ identity logged in instead. Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiUpdateSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateSettingsFlowRequest */ -func (a *FrontendApiService) UpdateSettingsFlow(ctx context.Context) FrontendApiApiUpdateSettingsFlowRequest { - return FrontendApiApiUpdateSettingsFlowRequest{ +func (a *FrontendApiService) UpdateSettingsFlow(ctx context.Context) FrontendApiUpdateSettingsFlowRequest { + return FrontendApiUpdateSettingsFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SettingsFlow - */ -func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { +// Execute executes the request +// +// @return SettingsFlow +func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiUpdateSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SettingsFlow + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SettingsFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.UpdateSettingsFlow") @@ -5554,7 +5694,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet return localVarReturnValue, nil, reportError("updateSettingsFlowBody is required and must be specified") } - localVarQueryParams.Add("flow", parameterToString(*r.flow, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "flow", r.flow, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} @@ -5573,14 +5713,14 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } // body params localVarPostBody = r.updateSettingsFlowBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -5609,6 +5749,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5619,6 +5760,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5629,6 +5771,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5639,6 +5782,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5649,6 +5793,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5658,6 +5803,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5674,7 +5820,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiUpdateVerificationFlowRequest struct { +type FrontendApiUpdateVerificationFlowRequest struct { ctx context.Context ApiService FrontendApi flow *string @@ -5683,31 +5829,37 @@ type FrontendApiApiUpdateVerificationFlowRequest struct { cookie *string } -func (r FrontendApiApiUpdateVerificationFlowRequest) Flow(flow string) FrontendApiApiUpdateVerificationFlowRequest { +// The Verification Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/verification?flow=abcde`). +func (r FrontendApiUpdateVerificationFlowRequest) Flow(flow string) FrontendApiUpdateVerificationFlowRequest { r.flow = &flow return r } -func (r FrontendApiApiUpdateVerificationFlowRequest) UpdateVerificationFlowBody(updateVerificationFlowBody UpdateVerificationFlowBody) FrontendApiApiUpdateVerificationFlowRequest { + +func (r FrontendApiUpdateVerificationFlowRequest) UpdateVerificationFlowBody(updateVerificationFlowBody UpdateVerificationFlowBody) FrontendApiUpdateVerificationFlowRequest { r.updateVerificationFlowBody = &updateVerificationFlowBody return r } -func (r FrontendApiApiUpdateVerificationFlowRequest) Token(token string) FrontendApiApiUpdateVerificationFlowRequest { + +// Verification Token The verification token which completes the verification request. If the token is invalid (e.g. expired) an error will be shown to the end-user. This parameter is usually set in a link and not used by any direct API call. +func (r FrontendApiUpdateVerificationFlowRequest) Token(token string) FrontendApiUpdateVerificationFlowRequest { r.token = &token return r } -func (r FrontendApiApiUpdateVerificationFlowRequest) Cookie(cookie string) FrontendApiApiUpdateVerificationFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiUpdateVerificationFlowRequest) Cookie(cookie string) FrontendApiUpdateVerificationFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiUpdateVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { +func (r FrontendApiUpdateVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { return r.ApiService.UpdateVerificationFlowExecute(r) } /* - - UpdateVerificationFlow Complete Verification Flow - - Use this endpoint to complete a verification flow. This endpoint +UpdateVerificationFlow Complete Verification Flow +Use this endpoint to complete a verification flow. This endpoint behaves differently for API and browser flows and has several states: `choose_method` expects `flow` (in the URL query) and `email` (in the body) to be sent @@ -5723,28 +5875,26 @@ does not have any API capabilities. The server responds with a HTTP 303 See Othe a new Verification Flow ID which contains an error message that the verification link was invalid. More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiUpdateVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateVerificationFlowRequest */ -func (a *FrontendApiService) UpdateVerificationFlow(ctx context.Context) FrontendApiApiUpdateVerificationFlowRequest { - return FrontendApiApiUpdateVerificationFlowRequest{ +func (a *FrontendApiService) UpdateVerificationFlow(ctx context.Context) FrontendApiUpdateVerificationFlowRequest { + return FrontendApiUpdateVerificationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return VerificationFlow - */ -func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiApiUpdateVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { +// Execute executes the request +// +// @return VerificationFlow +func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiUpdateVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *VerificationFlow + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VerificationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.UpdateVerificationFlow") @@ -5764,9 +5914,9 @@ func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiApiUpdat return localVarReturnValue, nil, reportError("updateVerificationFlowBody is required and must be specified") } - localVarQueryParams.Add("flow", parameterToString(*r.flow, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "flow", r.flow, "") if r.token != nil { - localVarQueryParams.Add("token", parameterToString(*r.token, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "token", r.token, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} @@ -5786,11 +5936,11 @@ func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiApiUpdat localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } // body params localVarPostBody = r.updateVerificationFlowBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -5819,6 +5969,7 @@ func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5829,6 +5980,7 @@ func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5838,6 +5990,7 @@ func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/internal/client-go/api_identity.go b/internal/client-go/api_identity.go index bc1b675876fb..8718ac8d6b5b 100644 --- a/internal/client-go/api_identity.go +++ b/internal/client-go/api_identity.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -21,341 +21,334 @@ import ( "strings" ) -// Linger please -var ( - _ context.Context -) - type IdentityApi interface { /* - * BatchPatchIdentities Create and deletes multiple identities - * Creates or delete multiple + BatchPatchIdentities Create and deletes multiple identities + + Creates or delete multiple [identities](https://www.ory.sh/docs/kratos/concepts/identity-user-model). This endpoint can also be used to [import credentials](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities) for instance passwords, social sign in configurations or multifactor methods. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiBatchPatchIdentitiesRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiBatchPatchIdentitiesRequest */ - BatchPatchIdentities(ctx context.Context) IdentityApiApiBatchPatchIdentitiesRequest + BatchPatchIdentities(ctx context.Context) IdentityApiBatchPatchIdentitiesRequest - /* - * BatchPatchIdentitiesExecute executes the request - * @return BatchPatchIdentitiesResponse - */ - BatchPatchIdentitiesExecute(r IdentityApiApiBatchPatchIdentitiesRequest) (*BatchPatchIdentitiesResponse, *http.Response, error) + // BatchPatchIdentitiesExecute executes the request + // @return BatchPatchIdentitiesResponse + BatchPatchIdentitiesExecute(r IdentityApiBatchPatchIdentitiesRequest) (*BatchPatchIdentitiesResponse, *http.Response, error) /* - * CreateIdentity Create an Identity - * Create an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). This endpoint can also be used to + CreateIdentity Create an Identity + + Create an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). This endpoint can also be used to [import credentials](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities) for instance passwords, social sign in configurations or multifactor methods. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiCreateIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiCreateIdentityRequest */ - CreateIdentity(ctx context.Context) IdentityApiApiCreateIdentityRequest + CreateIdentity(ctx context.Context) IdentityApiCreateIdentityRequest - /* - * CreateIdentityExecute executes the request - * @return Identity - */ - CreateIdentityExecute(r IdentityApiApiCreateIdentityRequest) (*Identity, *http.Response, error) + // CreateIdentityExecute executes the request + // @return Identity + CreateIdentityExecute(r IdentityApiCreateIdentityRequest) (*Identity, *http.Response, error) /* - * CreateRecoveryCodeForIdentity Create a Recovery Code - * This endpoint creates a recovery code which should be given to the user in order for them to recover + CreateRecoveryCodeForIdentity Create a Recovery Code + + This endpoint creates a recovery code which should be given to the user in order for them to recover (or activate) their account. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiCreateRecoveryCodeForIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiCreateRecoveryCodeForIdentityRequest */ - CreateRecoveryCodeForIdentity(ctx context.Context) IdentityApiApiCreateRecoveryCodeForIdentityRequest + CreateRecoveryCodeForIdentity(ctx context.Context) IdentityApiCreateRecoveryCodeForIdentityRequest - /* - * CreateRecoveryCodeForIdentityExecute executes the request - * @return RecoveryCodeForIdentity - */ - CreateRecoveryCodeForIdentityExecute(r IdentityApiApiCreateRecoveryCodeForIdentityRequest) (*RecoveryCodeForIdentity, *http.Response, error) + // CreateRecoveryCodeForIdentityExecute executes the request + // @return RecoveryCodeForIdentity + CreateRecoveryCodeForIdentityExecute(r IdentityApiCreateRecoveryCodeForIdentityRequest) (*RecoveryCodeForIdentity, *http.Response, error) /* - * CreateRecoveryLinkForIdentity Create a Recovery Link - * This endpoint creates a recovery link which should be given to the user in order for them to recover + CreateRecoveryLinkForIdentity Create a Recovery Link + + This endpoint creates a recovery link which should be given to the user in order for them to recover (or activate) their account. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiCreateRecoveryLinkForIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiCreateRecoveryLinkForIdentityRequest */ - CreateRecoveryLinkForIdentity(ctx context.Context) IdentityApiApiCreateRecoveryLinkForIdentityRequest + CreateRecoveryLinkForIdentity(ctx context.Context) IdentityApiCreateRecoveryLinkForIdentityRequest - /* - * CreateRecoveryLinkForIdentityExecute executes the request - * @return RecoveryLinkForIdentity - */ - CreateRecoveryLinkForIdentityExecute(r IdentityApiApiCreateRecoveryLinkForIdentityRequest) (*RecoveryLinkForIdentity, *http.Response, error) + // CreateRecoveryLinkForIdentityExecute executes the request + // @return RecoveryLinkForIdentity + CreateRecoveryLinkForIdentityExecute(r IdentityApiCreateRecoveryLinkForIdentityRequest) (*RecoveryLinkForIdentity, *http.Response, error) /* - * DeleteIdentity Delete an Identity - * Calling this endpoint irrecoverably and permanently deletes the [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) given its ID. This action can not be undone. + DeleteIdentity Delete an Identity + + Calling this endpoint irrecoverably and permanently deletes the [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) given its ID. This action can not be undone. This endpoint returns 204 when the identity was deleted or when the identity was not found, in which case it is assumed that is has been deleted already. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the identity's ID. - * @return IdentityApiApiDeleteIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @return IdentityApiDeleteIdentityRequest */ - DeleteIdentity(ctx context.Context, id string) IdentityApiApiDeleteIdentityRequest + DeleteIdentity(ctx context.Context, id string) IdentityApiDeleteIdentityRequest - /* - * DeleteIdentityExecute executes the request - */ - DeleteIdentityExecute(r IdentityApiApiDeleteIdentityRequest) (*http.Response, error) + // DeleteIdentityExecute executes the request + DeleteIdentityExecute(r IdentityApiDeleteIdentityRequest) (*http.Response, error) /* - * DeleteIdentityCredentials Delete a credential for a specific identity - * Delete an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) credential by its type + DeleteIdentityCredentials Delete a credential for a specific identity + + Delete an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) credential by its type You can only delete second factor (aal2) credentials. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the identity's ID. - * @param type_ Type is the type of credentials to be deleted. password CredentialsTypePassword oidc CredentialsTypeOIDC totp CredentialsTypeTOTP lookup_secret CredentialsTypeLookup webauthn CredentialsTypeWebAuthn code CredentialsTypeCodeAuth link_recovery CredentialsTypeRecoveryLink CredentialsTypeRecoveryLink is a special credential type linked to the link strategy (recovery flow). It is not used within the credentials object itself. code_recovery CredentialsTypeRecoveryCode - * @return IdentityApiApiDeleteIdentityCredentialsRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @param type_ Type is the type of credentials to be deleted. password CredentialsTypePassword oidc CredentialsTypeOIDC totp CredentialsTypeTOTP lookup_secret CredentialsTypeLookup webauthn CredentialsTypeWebAuthn code CredentialsTypeCodeAuth link_recovery CredentialsTypeRecoveryLink CredentialsTypeRecoveryLink is a special credential type linked to the link strategy (recovery flow). It is not used within the credentials object itself. code_recovery CredentialsTypeRecoveryCode + @return IdentityApiDeleteIdentityCredentialsRequest */ - DeleteIdentityCredentials(ctx context.Context, id string, type_ string) IdentityApiApiDeleteIdentityCredentialsRequest + DeleteIdentityCredentials(ctx context.Context, id string, type_ string) IdentityApiDeleteIdentityCredentialsRequest - /* - * DeleteIdentityCredentialsExecute executes the request - */ - DeleteIdentityCredentialsExecute(r IdentityApiApiDeleteIdentityCredentialsRequest) (*http.Response, error) + // DeleteIdentityCredentialsExecute executes the request + DeleteIdentityCredentialsExecute(r IdentityApiDeleteIdentityCredentialsRequest) (*http.Response, error) /* - * DeleteIdentitySessions Delete & Invalidate an Identity's Sessions - * Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the identity's ID. - * @return IdentityApiApiDeleteIdentitySessionsRequest - */ - DeleteIdentitySessions(ctx context.Context, id string) IdentityApiApiDeleteIdentitySessionsRequest + DeleteIdentitySessions Delete & Invalidate an Identity's Sessions - /* - * DeleteIdentitySessionsExecute executes the request - */ - DeleteIdentitySessionsExecute(r IdentityApiApiDeleteIdentitySessionsRequest) (*http.Response, error) + Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity. - /* - * DisableSession Deactivate a Session - * Calling this endpoint deactivates the specified session. Session data is not deleted. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the session's ID. - * @return IdentityApiApiDisableSessionRequest - */ - DisableSession(ctx context.Context, id string) IdentityApiApiDisableSessionRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @return IdentityApiDeleteIdentitySessionsRequest + */ + DeleteIdentitySessions(ctx context.Context, id string) IdentityApiDeleteIdentitySessionsRequest + + // DeleteIdentitySessionsExecute executes the request + DeleteIdentitySessionsExecute(r IdentityApiDeleteIdentitySessionsRequest) (*http.Response, error) /* - * DisableSessionExecute executes the request - */ - DisableSessionExecute(r IdentityApiApiDisableSessionRequest) (*http.Response, error) + DisableSession Deactivate a Session + + Calling this endpoint deactivates the specified session. Session data is not deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return IdentityApiDisableSessionRequest + */ + DisableSession(ctx context.Context, id string) IdentityApiDisableSessionRequest + + // DisableSessionExecute executes the request + DisableSessionExecute(r IdentityApiDisableSessionRequest) (*http.Response, error) /* - * ExtendSession Extend a Session - * Calling this endpoint extends the given session ID. If `session.earliest_possible_extend` is set it + ExtendSession Extend a Session + + Calling this endpoint extends the given session ID. If `session.earliest_possible_extend` is set it will only extend the session after the specified time has passed. Retrieve the session ID from the `/sessions/whoami` endpoint / `toSession` SDK method. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the session's ID. - * @return IdentityApiApiExtendSessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return IdentityApiExtendSessionRequest */ - ExtendSession(ctx context.Context, id string) IdentityApiApiExtendSessionRequest + ExtendSession(ctx context.Context, id string) IdentityApiExtendSessionRequest - /* - * ExtendSessionExecute executes the request - * @return Session - */ - ExtendSessionExecute(r IdentityApiApiExtendSessionRequest) (*Session, *http.Response, error) + // ExtendSessionExecute executes the request + // @return Session + ExtendSessionExecute(r IdentityApiExtendSessionRequest) (*Session, *http.Response, error) /* - * GetIdentity Get an Identity - * Return an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) by its ID. You can optionally + GetIdentity Get an Identity + + Return an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) by its ID. You can optionally include credentials (e.g. social sign in connections) in the response by using the `include_credential` query parameter. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID must be set to the ID of identity you want to get - * @return IdentityApiApiGetIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of identity you want to get + @return IdentityApiGetIdentityRequest */ - GetIdentity(ctx context.Context, id string) IdentityApiApiGetIdentityRequest + GetIdentity(ctx context.Context, id string) IdentityApiGetIdentityRequest - /* - * GetIdentityExecute executes the request - * @return Identity - */ - GetIdentityExecute(r IdentityApiApiGetIdentityRequest) (*Identity, *http.Response, error) + // GetIdentityExecute executes the request + // @return Identity + GetIdentityExecute(r IdentityApiGetIdentityRequest) (*Identity, *http.Response, error) /* - * GetIdentitySchema Get Identity JSON Schema - * Return a specific identity schema. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID must be set to the ID of schema you want to get - * @return IdentityApiApiGetIdentitySchemaRequest - */ - GetIdentitySchema(ctx context.Context, id string) IdentityApiApiGetIdentitySchemaRequest + GetIdentitySchema Get Identity JSON Schema - /* - * GetIdentitySchemaExecute executes the request - * @return map[string]interface{} - */ - GetIdentitySchemaExecute(r IdentityApiApiGetIdentitySchemaRequest) (map[string]interface{}, *http.Response, error) + Return a specific identity schema. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of schema you want to get + @return IdentityApiGetIdentitySchemaRequest + */ + GetIdentitySchema(ctx context.Context, id string) IdentityApiGetIdentitySchemaRequest + + // GetIdentitySchemaExecute executes the request + // @return map[string]interface{} + GetIdentitySchemaExecute(r IdentityApiGetIdentitySchemaRequest) (map[string]interface{}, *http.Response, error) /* - * GetSession Get Session - * This endpoint is useful for: + GetSession Get Session + + This endpoint is useful for: Getting a session object with all specified expandables that exist in an administrative context. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the session's ID. - * @return IdentityApiApiGetSessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return IdentityApiGetSessionRequest */ - GetSession(ctx context.Context, id string) IdentityApiApiGetSessionRequest + GetSession(ctx context.Context, id string) IdentityApiGetSessionRequest - /* - * GetSessionExecute executes the request - * @return Session - */ - GetSessionExecute(r IdentityApiApiGetSessionRequest) (*Session, *http.Response, error) + // GetSessionExecute executes the request + // @return Session + GetSessionExecute(r IdentityApiGetSessionRequest) (*Session, *http.Response, error) /* - * ListIdentities List Identities - * Lists all [identities](https://www.ory.sh/docs/kratos/concepts/identity-user-model) in the system. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiListIdentitiesRequest - */ - ListIdentities(ctx context.Context) IdentityApiApiListIdentitiesRequest + ListIdentities List Identities - /* - * ListIdentitiesExecute executes the request - * @return []Identity - */ - ListIdentitiesExecute(r IdentityApiApiListIdentitiesRequest) ([]Identity, *http.Response, error) + Lists all [identities](https://www.ory.sh/docs/kratos/concepts/identity-user-model) in the system. - /* - * ListIdentitySchemas Get all Identity Schemas - * Returns a list of all identity schemas currently in use. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiListIdentitySchemasRequest - */ - ListIdentitySchemas(ctx context.Context) IdentityApiApiListIdentitySchemasRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiListIdentitiesRequest + */ + ListIdentities(ctx context.Context) IdentityApiListIdentitiesRequest - /* - * ListIdentitySchemasExecute executes the request - * @return []IdentitySchemaContainer - */ - ListIdentitySchemasExecute(r IdentityApiApiListIdentitySchemasRequest) ([]IdentitySchemaContainer, *http.Response, error) + // ListIdentitiesExecute executes the request + // @return []Identity + ListIdentitiesExecute(r IdentityApiListIdentitiesRequest) ([]Identity, *http.Response, error) /* - * ListIdentitySessions List an Identity's Sessions - * This endpoint returns all sessions that belong to the given Identity. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the identity's ID. - * @return IdentityApiApiListIdentitySessionsRequest - */ - ListIdentitySessions(ctx context.Context, id string) IdentityApiApiListIdentitySessionsRequest + ListIdentitySchemas Get all Identity Schemas - /* - * ListIdentitySessionsExecute executes the request - * @return []Session - */ - ListIdentitySessionsExecute(r IdentityApiApiListIdentitySessionsRequest) ([]Session, *http.Response, error) + Returns a list of all identity schemas currently in use. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiListIdentitySchemasRequest + */ + ListIdentitySchemas(ctx context.Context) IdentityApiListIdentitySchemasRequest + + // ListIdentitySchemasExecute executes the request + // @return []IdentitySchemaContainer + ListIdentitySchemasExecute(r IdentityApiListIdentitySchemasRequest) ([]IdentitySchemaContainer, *http.Response, error) /* - * ListSessions List All Sessions - * Listing all sessions that exist. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiListSessionsRequest - */ - ListSessions(ctx context.Context) IdentityApiApiListSessionsRequest + ListIdentitySessions List an Identity's Sessions + + This endpoint returns all sessions that belong to the given Identity. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @return IdentityApiListIdentitySessionsRequest + */ + ListIdentitySessions(ctx context.Context, id string) IdentityApiListIdentitySessionsRequest + + // ListIdentitySessionsExecute executes the request + // @return []Session + ListIdentitySessionsExecute(r IdentityApiListIdentitySessionsRequest) ([]Session, *http.Response, error) /* - * ListSessionsExecute executes the request - * @return []Session - */ - ListSessionsExecute(r IdentityApiApiListSessionsRequest) ([]Session, *http.Response, error) + ListSessions List All Sessions + + Listing all sessions that exist. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiListSessionsRequest + */ + ListSessions(ctx context.Context) IdentityApiListSessionsRequest + + // ListSessionsExecute executes the request + // @return []Session + ListSessionsExecute(r IdentityApiListSessionsRequest) ([]Session, *http.Response, error) /* - * PatchIdentity Patch an Identity - * Partially updates an [identity's](https://www.ory.sh/docs/kratos/concepts/identity-user-model) field using [JSON Patch](https://jsonpatch.com/). + PatchIdentity Patch an Identity + + Partially updates an [identity's](https://www.ory.sh/docs/kratos/concepts/identity-user-model) field using [JSON Patch](https://jsonpatch.com/). The fields `id`, `stateChangedAt` and `credentials` can not be updated using this method. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID must be set to the ID of identity you want to update - * @return IdentityApiApiPatchIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of identity you want to update + @return IdentityApiPatchIdentityRequest */ - PatchIdentity(ctx context.Context, id string) IdentityApiApiPatchIdentityRequest + PatchIdentity(ctx context.Context, id string) IdentityApiPatchIdentityRequest - /* - * PatchIdentityExecute executes the request - * @return Identity - */ - PatchIdentityExecute(r IdentityApiApiPatchIdentityRequest) (*Identity, *http.Response, error) + // PatchIdentityExecute executes the request + // @return Identity + PatchIdentityExecute(r IdentityApiPatchIdentityRequest) (*Identity, *http.Response, error) /* - * UpdateIdentity Update an Identity - * This endpoint updates an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). The full identity + UpdateIdentity Update an Identity + + This endpoint updates an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). The full identity payload (except credentials) is expected. It is possible to update the identity's credentials as well. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID must be set to the ID of identity you want to update - * @return IdentityApiApiUpdateIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of identity you want to update + @return IdentityApiUpdateIdentityRequest */ - UpdateIdentity(ctx context.Context, id string) IdentityApiApiUpdateIdentityRequest + UpdateIdentity(ctx context.Context, id string) IdentityApiUpdateIdentityRequest - /* - * UpdateIdentityExecute executes the request - * @return Identity - */ - UpdateIdentityExecute(r IdentityApiApiUpdateIdentityRequest) (*Identity, *http.Response, error) + // UpdateIdentityExecute executes the request + // @return Identity + UpdateIdentityExecute(r IdentityApiUpdateIdentityRequest) (*Identity, *http.Response, error) } // IdentityApiService IdentityApi service type IdentityApiService service -type IdentityApiApiBatchPatchIdentitiesRequest struct { +type IdentityApiBatchPatchIdentitiesRequest struct { ctx context.Context ApiService IdentityApi patchIdentitiesBody *PatchIdentitiesBody } -func (r IdentityApiApiBatchPatchIdentitiesRequest) PatchIdentitiesBody(patchIdentitiesBody PatchIdentitiesBody) IdentityApiApiBatchPatchIdentitiesRequest { +func (r IdentityApiBatchPatchIdentitiesRequest) PatchIdentitiesBody(patchIdentitiesBody PatchIdentitiesBody) IdentityApiBatchPatchIdentitiesRequest { r.patchIdentitiesBody = &patchIdentitiesBody return r } -func (r IdentityApiApiBatchPatchIdentitiesRequest) Execute() (*BatchPatchIdentitiesResponse, *http.Response, error) { +func (r IdentityApiBatchPatchIdentitiesRequest) Execute() (*BatchPatchIdentitiesResponse, *http.Response, error) { return r.ApiService.BatchPatchIdentitiesExecute(r) } /* - - BatchPatchIdentities Create and deletes multiple identities - - Creates or delete multiple +BatchPatchIdentities Create and deletes multiple identities +Creates or delete multiple [identities](https://www.ory.sh/docs/kratos/concepts/identity-user-model). This endpoint can also be used to [import credentials](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities) for instance passwords, social sign in configurations or multifactor methods. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return IdentityApiApiBatchPatchIdentitiesRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiBatchPatchIdentitiesRequest */ -func (a *IdentityApiService) BatchPatchIdentities(ctx context.Context) IdentityApiApiBatchPatchIdentitiesRequest { - return IdentityApiApiBatchPatchIdentitiesRequest{ +func (a *IdentityApiService) BatchPatchIdentities(ctx context.Context) IdentityApiBatchPatchIdentitiesRequest { + return IdentityApiBatchPatchIdentitiesRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return BatchPatchIdentitiesResponse - */ -func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiApiBatchPatchIdentitiesRequest) (*BatchPatchIdentitiesResponse, *http.Response, error) { +// Execute executes the request +// +// @return BatchPatchIdentitiesResponse +func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiBatchPatchIdentitiesRequest) (*BatchPatchIdentitiesResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPatch - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *BatchPatchIdentitiesResponse + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BatchPatchIdentitiesResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.BatchPatchIdentities") @@ -402,7 +395,7 @@ func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiApiBatchPa } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -431,6 +424,7 @@ func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiApiBatchPa newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -441,6 +435,7 @@ func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiApiBatchPa newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -450,6 +445,7 @@ func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiApiBatchPa newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -466,49 +462,47 @@ func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiApiBatchPa return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiCreateIdentityRequest struct { +type IdentityApiCreateIdentityRequest struct { ctx context.Context ApiService IdentityApi createIdentityBody *CreateIdentityBody } -func (r IdentityApiApiCreateIdentityRequest) CreateIdentityBody(createIdentityBody CreateIdentityBody) IdentityApiApiCreateIdentityRequest { +func (r IdentityApiCreateIdentityRequest) CreateIdentityBody(createIdentityBody CreateIdentityBody) IdentityApiCreateIdentityRequest { r.createIdentityBody = &createIdentityBody return r } -func (r IdentityApiApiCreateIdentityRequest) Execute() (*Identity, *http.Response, error) { +func (r IdentityApiCreateIdentityRequest) Execute() (*Identity, *http.Response, error) { return r.ApiService.CreateIdentityExecute(r) } /* - - CreateIdentity Create an Identity - - Create an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). This endpoint can also be used to +CreateIdentity Create an Identity +Create an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). This endpoint can also be used to [import credentials](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities) for instance passwords, social sign in configurations or multifactor methods. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return IdentityApiApiCreateIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiCreateIdentityRequest */ -func (a *IdentityApiService) CreateIdentity(ctx context.Context) IdentityApiApiCreateIdentityRequest { - return IdentityApiApiCreateIdentityRequest{ +func (a *IdentityApiService) CreateIdentity(ctx context.Context) IdentityApiCreateIdentityRequest { + return IdentityApiCreateIdentityRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return Identity - */ -func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiApiCreateIdentityRequest) (*Identity, *http.Response, error) { +// Execute executes the request +// +// @return Identity +func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiCreateIdentityRequest) (*Identity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Identity + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Identity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.CreateIdentity") @@ -555,7 +549,7 @@ func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiApiCreateIdentit } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -584,6 +578,7 @@ func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiApiCreateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -594,6 +589,7 @@ func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiApiCreateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -603,6 +599,7 @@ func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiApiCreateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -619,48 +616,46 @@ func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiApiCreateIdentit return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiCreateRecoveryCodeForIdentityRequest struct { +type IdentityApiCreateRecoveryCodeForIdentityRequest struct { ctx context.Context ApiService IdentityApi createRecoveryCodeForIdentityBody *CreateRecoveryCodeForIdentityBody } -func (r IdentityApiApiCreateRecoveryCodeForIdentityRequest) CreateRecoveryCodeForIdentityBody(createRecoveryCodeForIdentityBody CreateRecoveryCodeForIdentityBody) IdentityApiApiCreateRecoveryCodeForIdentityRequest { +func (r IdentityApiCreateRecoveryCodeForIdentityRequest) CreateRecoveryCodeForIdentityBody(createRecoveryCodeForIdentityBody CreateRecoveryCodeForIdentityBody) IdentityApiCreateRecoveryCodeForIdentityRequest { r.createRecoveryCodeForIdentityBody = &createRecoveryCodeForIdentityBody return r } -func (r IdentityApiApiCreateRecoveryCodeForIdentityRequest) Execute() (*RecoveryCodeForIdentity, *http.Response, error) { +func (r IdentityApiCreateRecoveryCodeForIdentityRequest) Execute() (*RecoveryCodeForIdentity, *http.Response, error) { return r.ApiService.CreateRecoveryCodeForIdentityExecute(r) } /* - - CreateRecoveryCodeForIdentity Create a Recovery Code - - This endpoint creates a recovery code which should be given to the user in order for them to recover +CreateRecoveryCodeForIdentity Create a Recovery Code +This endpoint creates a recovery code which should be given to the user in order for them to recover (or activate) their account. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return IdentityApiApiCreateRecoveryCodeForIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiCreateRecoveryCodeForIdentityRequest */ -func (a *IdentityApiService) CreateRecoveryCodeForIdentity(ctx context.Context) IdentityApiApiCreateRecoveryCodeForIdentityRequest { - return IdentityApiApiCreateRecoveryCodeForIdentityRequest{ +func (a *IdentityApiService) CreateRecoveryCodeForIdentity(ctx context.Context) IdentityApiCreateRecoveryCodeForIdentityRequest { + return IdentityApiCreateRecoveryCodeForIdentityRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RecoveryCodeForIdentity - */ -func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiApiCreateRecoveryCodeForIdentityRequest) (*RecoveryCodeForIdentity, *http.Response, error) { +// Execute executes the request +// +// @return RecoveryCodeForIdentity +func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiCreateRecoveryCodeForIdentityRequest) (*RecoveryCodeForIdentity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RecoveryCodeForIdentity + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryCodeForIdentity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.CreateRecoveryCodeForIdentity") @@ -707,7 +702,7 @@ func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiA } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -736,6 +731,7 @@ func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -746,6 +742,7 @@ func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -755,6 +752,7 @@ func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -771,53 +769,52 @@ func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiA return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiCreateRecoveryLinkForIdentityRequest struct { +type IdentityApiCreateRecoveryLinkForIdentityRequest struct { ctx context.Context ApiService IdentityApi returnTo *string createRecoveryLinkForIdentityBody *CreateRecoveryLinkForIdentityBody } -func (r IdentityApiApiCreateRecoveryLinkForIdentityRequest) ReturnTo(returnTo string) IdentityApiApiCreateRecoveryLinkForIdentityRequest { +func (r IdentityApiCreateRecoveryLinkForIdentityRequest) ReturnTo(returnTo string) IdentityApiCreateRecoveryLinkForIdentityRequest { r.returnTo = &returnTo return r } -func (r IdentityApiApiCreateRecoveryLinkForIdentityRequest) CreateRecoveryLinkForIdentityBody(createRecoveryLinkForIdentityBody CreateRecoveryLinkForIdentityBody) IdentityApiApiCreateRecoveryLinkForIdentityRequest { + +func (r IdentityApiCreateRecoveryLinkForIdentityRequest) CreateRecoveryLinkForIdentityBody(createRecoveryLinkForIdentityBody CreateRecoveryLinkForIdentityBody) IdentityApiCreateRecoveryLinkForIdentityRequest { r.createRecoveryLinkForIdentityBody = &createRecoveryLinkForIdentityBody return r } -func (r IdentityApiApiCreateRecoveryLinkForIdentityRequest) Execute() (*RecoveryLinkForIdentity, *http.Response, error) { +func (r IdentityApiCreateRecoveryLinkForIdentityRequest) Execute() (*RecoveryLinkForIdentity, *http.Response, error) { return r.ApiService.CreateRecoveryLinkForIdentityExecute(r) } /* - - CreateRecoveryLinkForIdentity Create a Recovery Link - - This endpoint creates a recovery link which should be given to the user in order for them to recover +CreateRecoveryLinkForIdentity Create a Recovery Link +This endpoint creates a recovery link which should be given to the user in order for them to recover (or activate) their account. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return IdentityApiApiCreateRecoveryLinkForIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiCreateRecoveryLinkForIdentityRequest */ -func (a *IdentityApiService) CreateRecoveryLinkForIdentity(ctx context.Context) IdentityApiApiCreateRecoveryLinkForIdentityRequest { - return IdentityApiApiCreateRecoveryLinkForIdentityRequest{ +func (a *IdentityApiService) CreateRecoveryLinkForIdentity(ctx context.Context) IdentityApiCreateRecoveryLinkForIdentityRequest { + return IdentityApiCreateRecoveryLinkForIdentityRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RecoveryLinkForIdentity - */ -func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiApiCreateRecoveryLinkForIdentityRequest) (*RecoveryLinkForIdentity, *http.Response, error) { +// Execute executes the request +// +// @return RecoveryLinkForIdentity +func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiCreateRecoveryLinkForIdentityRequest) (*RecoveryLinkForIdentity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RecoveryLinkForIdentity + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryLinkForIdentity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.CreateRecoveryLinkForIdentity") @@ -832,7 +829,7 @@ func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiA localVarFormParams := url.Values{} if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -867,7 +864,7 @@ func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiA } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -896,6 +893,7 @@ func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -906,6 +904,7 @@ func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -915,6 +914,7 @@ func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -931,44 +931,41 @@ func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiA return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiDeleteIdentityRequest struct { +type IdentityApiDeleteIdentityRequest struct { ctx context.Context ApiService IdentityApi id string } -func (r IdentityApiApiDeleteIdentityRequest) Execute() (*http.Response, error) { +func (r IdentityApiDeleteIdentityRequest) Execute() (*http.Response, error) { return r.ApiService.DeleteIdentityExecute(r) } /* - - DeleteIdentity Delete an Identity - - Calling this endpoint irrecoverably and permanently deletes the [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) given its ID. This action can not be undone. +DeleteIdentity Delete an Identity +Calling this endpoint irrecoverably and permanently deletes the [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) given its ID. This action can not be undone. This endpoint returns 204 when the identity was deleted or when the identity was not found, in which case it is assumed that is has been deleted already. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID is the identity's ID. - - @return IdentityApiApiDeleteIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @return IdentityApiDeleteIdentityRequest */ -func (a *IdentityApiService) DeleteIdentity(ctx context.Context, id string) IdentityApiApiDeleteIdentityRequest { - return IdentityApiApiDeleteIdentityRequest{ +func (a *IdentityApiService) DeleteIdentity(ctx context.Context, id string) IdentityApiDeleteIdentityRequest { + return IdentityApiDeleteIdentityRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - */ -func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiApiDeleteIdentityRequest) (*http.Response, error) { +// Execute executes the request +func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiDeleteIdentityRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.DeleteIdentity") @@ -977,7 +974,7 @@ func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiApiDeleteIdentit } localVarPath := localBasePath + "/admin/identities/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1014,7 +1011,7 @@ func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiApiDeleteIdentit } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -1043,6 +1040,7 @@ func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiApiDeleteIdentit newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1052,6 +1050,7 @@ func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiApiDeleteIdentit newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1059,29 +1058,30 @@ func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiApiDeleteIdentit return localVarHTTPResponse, nil } -type IdentityApiApiDeleteIdentityCredentialsRequest struct { +type IdentityApiDeleteIdentityCredentialsRequest struct { ctx context.Context ApiService IdentityApi id string type_ string } -func (r IdentityApiApiDeleteIdentityCredentialsRequest) Execute() (*http.Response, error) { +func (r IdentityApiDeleteIdentityCredentialsRequest) Execute() (*http.Response, error) { return r.ApiService.DeleteIdentityCredentialsExecute(r) } /* - - DeleteIdentityCredentials Delete a credential for a specific identity - - Delete an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) credential by its type +DeleteIdentityCredentials Delete a credential for a specific identity +Delete an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) credential by its type You can only delete second factor (aal2) credentials. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID is the identity's ID. - - @param type_ Type is the type of credentials to be deleted. password CredentialsTypePassword oidc CredentialsTypeOIDC totp CredentialsTypeTOTP lookup_secret CredentialsTypeLookup webauthn CredentialsTypeWebAuthn code CredentialsTypeCodeAuth link_recovery CredentialsTypeRecoveryLink CredentialsTypeRecoveryLink is a special credential type linked to the link strategy (recovery flow). It is not used within the credentials object itself. code_recovery CredentialsTypeRecoveryCode - - @return IdentityApiApiDeleteIdentityCredentialsRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @param type_ Type is the type of credentials to be deleted. password CredentialsTypePassword oidc CredentialsTypeOIDC totp CredentialsTypeTOTP lookup_secret CredentialsTypeLookup webauthn CredentialsTypeWebAuthn code CredentialsTypeCodeAuth link_recovery CredentialsTypeRecoveryLink CredentialsTypeRecoveryLink is a special credential type linked to the link strategy (recovery flow). It is not used within the credentials object itself. code_recovery CredentialsTypeRecoveryCode + @return IdentityApiDeleteIdentityCredentialsRequest */ -func (a *IdentityApiService) DeleteIdentityCredentials(ctx context.Context, id string, type_ string) IdentityApiApiDeleteIdentityCredentialsRequest { - return IdentityApiApiDeleteIdentityCredentialsRequest{ +func (a *IdentityApiService) DeleteIdentityCredentials(ctx context.Context, id string, type_ string) IdentityApiDeleteIdentityCredentialsRequest { + return IdentityApiDeleteIdentityCredentialsRequest{ ApiService: a, ctx: ctx, id: id, @@ -1089,16 +1089,12 @@ func (a *IdentityApiService) DeleteIdentityCredentials(ctx context.Context, id s } } -/* - * Execute executes the request - */ -func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiApiDeleteIdentityCredentialsRequest) (*http.Response, error) { +// Execute executes the request +func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiDeleteIdentityCredentialsRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.DeleteIdentityCredentials") @@ -1107,8 +1103,8 @@ func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiApiDe } localVarPath := localBasePath + "/admin/identities/{id}/credentials/{type}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"type"+"}", url.PathEscape(parameterToString(r.type_, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"type"+"}", url.PathEscape(parameterValueToString(r.type_, "type_")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1145,7 +1141,7 @@ func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiApiDe } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -1174,6 +1170,7 @@ func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiApiDe newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1183,6 +1180,7 @@ func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiApiDe newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1190,41 +1188,39 @@ func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiApiDe return localVarHTTPResponse, nil } -type IdentityApiApiDeleteIdentitySessionsRequest struct { +type IdentityApiDeleteIdentitySessionsRequest struct { ctx context.Context ApiService IdentityApi id string } -func (r IdentityApiApiDeleteIdentitySessionsRequest) Execute() (*http.Response, error) { +func (r IdentityApiDeleteIdentitySessionsRequest) Execute() (*http.Response, error) { return r.ApiService.DeleteIdentitySessionsExecute(r) } /* - * DeleteIdentitySessions Delete & Invalidate an Identity's Sessions - * Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the identity's ID. - * @return IdentityApiApiDeleteIdentitySessionsRequest - */ -func (a *IdentityApiService) DeleteIdentitySessions(ctx context.Context, id string) IdentityApiApiDeleteIdentitySessionsRequest { - return IdentityApiApiDeleteIdentitySessionsRequest{ +DeleteIdentitySessions Delete & Invalidate an Identity's Sessions + +Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @return IdentityApiDeleteIdentitySessionsRequest +*/ +func (a *IdentityApiService) DeleteIdentitySessions(ctx context.Context, id string) IdentityApiDeleteIdentitySessionsRequest { + return IdentityApiDeleteIdentitySessionsRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - */ -func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDeleteIdentitySessionsRequest) (*http.Response, error) { +// Execute executes the request +func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiDeleteIdentitySessionsRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.DeleteIdentitySessions") @@ -1233,7 +1229,7 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet } localVarPath := localBasePath + "/admin/identities/{id}/sessions" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1270,7 +1266,7 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -1299,6 +1295,7 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1309,6 +1306,7 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1319,6 +1317,7 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1328,6 +1327,7 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1335,41 +1335,39 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet return localVarHTTPResponse, nil } -type IdentityApiApiDisableSessionRequest struct { +type IdentityApiDisableSessionRequest struct { ctx context.Context ApiService IdentityApi id string } -func (r IdentityApiApiDisableSessionRequest) Execute() (*http.Response, error) { +func (r IdentityApiDisableSessionRequest) Execute() (*http.Response, error) { return r.ApiService.DisableSessionExecute(r) } /* - * DisableSession Deactivate a Session - * Calling this endpoint deactivates the specified session. Session data is not deleted. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the session's ID. - * @return IdentityApiApiDisableSessionRequest - */ -func (a *IdentityApiService) DisableSession(ctx context.Context, id string) IdentityApiApiDisableSessionRequest { - return IdentityApiApiDisableSessionRequest{ +DisableSession Deactivate a Session + +Calling this endpoint deactivates the specified session. Session data is not deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return IdentityApiDisableSessionRequest +*/ +func (a *IdentityApiService) DisableSession(ctx context.Context, id string) IdentityApiDisableSessionRequest { + return IdentityApiDisableSessionRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - */ -func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessionRequest) (*http.Response, error) { +// Execute executes the request +func (a *IdentityApiService) DisableSessionExecute(r IdentityApiDisableSessionRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.DisableSession") @@ -1378,7 +1376,7 @@ func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessio } localVarPath := localBasePath + "/admin/sessions/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1415,7 +1413,7 @@ func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessio } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -1444,6 +1442,7 @@ func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessio newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1454,6 +1453,7 @@ func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessio newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1463,6 +1463,7 @@ func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessio newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1470,47 +1471,45 @@ func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessio return localVarHTTPResponse, nil } -type IdentityApiApiExtendSessionRequest struct { +type IdentityApiExtendSessionRequest struct { ctx context.Context ApiService IdentityApi id string } -func (r IdentityApiApiExtendSessionRequest) Execute() (*Session, *http.Response, error) { +func (r IdentityApiExtendSessionRequest) Execute() (*Session, *http.Response, error) { return r.ApiService.ExtendSessionExecute(r) } /* - - ExtendSession Extend a Session - - Calling this endpoint extends the given session ID. If `session.earliest_possible_extend` is set it +ExtendSession Extend a Session +Calling this endpoint extends the given session ID. If `session.earliest_possible_extend` is set it will only extend the session after the specified time has passed. Retrieve the session ID from the `/sessions/whoami` endpoint / `toSession` SDK method. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID is the session's ID. - - @return IdentityApiApiExtendSessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return IdentityApiExtendSessionRequest */ -func (a *IdentityApiService) ExtendSession(ctx context.Context, id string) IdentityApiApiExtendSessionRequest { - return IdentityApiApiExtendSessionRequest{ +func (a *IdentityApiService) ExtendSession(ctx context.Context, id string) IdentityApiExtendSessionRequest { + return IdentityApiExtendSessionRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return Session - */ -func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionRequest) (*Session, *http.Response, error) { +// Execute executes the request +// +// @return Session +func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiExtendSessionRequest) (*Session, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPatch - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Session + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Session ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.ExtendSession") @@ -1519,7 +1518,7 @@ func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionR } localVarPath := localBasePath + "/admin/sessions/{id}/extend" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1556,7 +1555,7 @@ func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionR } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1585,6 +1584,7 @@ func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1595,6 +1595,7 @@ func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1604,6 +1605,7 @@ func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1620,51 +1622,50 @@ func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionR return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiGetIdentityRequest struct { +type IdentityApiGetIdentityRequest struct { ctx context.Context ApiService IdentityApi id string includeCredential *[]string } -func (r IdentityApiApiGetIdentityRequest) IncludeCredential(includeCredential []string) IdentityApiApiGetIdentityRequest { +// Include Credentials in Response Include any credential, for example `password` or `oidc`, in the response. When set to `oidc`, This will return the initial OAuth 2.0 Access Token, OAuth 2.0 Refresh Token and the OpenID Connect ID Token if available. +func (r IdentityApiGetIdentityRequest) IncludeCredential(includeCredential []string) IdentityApiGetIdentityRequest { r.includeCredential = &includeCredential return r } -func (r IdentityApiApiGetIdentityRequest) Execute() (*Identity, *http.Response, error) { +func (r IdentityApiGetIdentityRequest) Execute() (*Identity, *http.Response, error) { return r.ApiService.GetIdentityExecute(r) } /* - - GetIdentity Get an Identity - - Return an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) by its ID. You can optionally +GetIdentity Get an Identity +Return an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) by its ID. You can optionally include credentials (e.g. social sign in connections) in the response by using the `include_credential` query parameter. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID must be set to the ID of identity you want to get - - @return IdentityApiApiGetIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of identity you want to get + @return IdentityApiGetIdentityRequest */ -func (a *IdentityApiService) GetIdentity(ctx context.Context, id string) IdentityApiApiGetIdentityRequest { - return IdentityApiApiGetIdentityRequest{ +func (a *IdentityApiService) GetIdentity(ctx context.Context, id string) IdentityApiGetIdentityRequest { + return IdentityApiGetIdentityRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return Identity - */ -func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityRequest) (*Identity, *http.Response, error) { +// Execute executes the request +// +// @return Identity +func (a *IdentityApiService) GetIdentityExecute(r IdentityApiGetIdentityRequest) (*Identity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Identity + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Identity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.GetIdentity") @@ -1673,7 +1674,7 @@ func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityReque } localVarPath := localBasePath + "/admin/identities/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1684,10 +1685,10 @@ func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityReque if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("include_credential", parameterToString(s.Index(i), "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "include_credential", s.Index(i).Interface(), "multi") } } else { - localVarQueryParams.Add("include_credential", parameterToString(t, "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "include_credential", t, "multi") } } // to determine the Content-Type header @@ -1721,7 +1722,7 @@ func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityReque } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1750,6 +1751,7 @@ func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityReque newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1759,6 +1761,7 @@ func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityReque newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1775,43 +1778,42 @@ func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityReque return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiGetIdentitySchemaRequest struct { +type IdentityApiGetIdentitySchemaRequest struct { ctx context.Context ApiService IdentityApi id string } -func (r IdentityApiApiGetIdentitySchemaRequest) Execute() (map[string]interface{}, *http.Response, error) { +func (r IdentityApiGetIdentitySchemaRequest) Execute() (map[string]interface{}, *http.Response, error) { return r.ApiService.GetIdentitySchemaExecute(r) } /* - * GetIdentitySchema Get Identity JSON Schema - * Return a specific identity schema. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID must be set to the ID of schema you want to get - * @return IdentityApiApiGetIdentitySchemaRequest - */ -func (a *IdentityApiService) GetIdentitySchema(ctx context.Context, id string) IdentityApiApiGetIdentitySchemaRequest { - return IdentityApiApiGetIdentitySchemaRequest{ +GetIdentitySchema Get Identity JSON Schema + +Return a specific identity schema. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of schema you want to get + @return IdentityApiGetIdentitySchemaRequest +*/ +func (a *IdentityApiService) GetIdentitySchema(ctx context.Context, id string) IdentityApiGetIdentitySchemaRequest { + return IdentityApiGetIdentitySchemaRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return map[string]interface{} - */ -func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiApiGetIdentitySchemaRequest) (map[string]interface{}, *http.Response, error) { +// Execute executes the request +// +// @return map[string]interface{} +func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiGetIdentitySchemaRequest) (map[string]interface{}, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue map[string]interface{} + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.GetIdentitySchema") @@ -1820,7 +1822,7 @@ func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiApiGetIdentit } localVarPath := localBasePath + "/schemas/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1843,7 +1845,7 @@ func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiApiGetIdentit if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1872,6 +1874,7 @@ func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiApiGetIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1881,6 +1884,7 @@ func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiApiGetIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1897,51 +1901,51 @@ func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiApiGetIdentit return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiGetSessionRequest struct { +type IdentityApiGetSessionRequest struct { ctx context.Context ApiService IdentityApi id string expand *[]string } -func (r IdentityApiApiGetSessionRequest) Expand(expand []string) IdentityApiApiGetSessionRequest { +// ExpandOptions is a query parameter encoded list of all properties that must be expanded in the Session. Example - ?expand=Identity&expand=Devices If no value is provided, the expandable properties are skipped. +func (r IdentityApiGetSessionRequest) Expand(expand []string) IdentityApiGetSessionRequest { r.expand = &expand return r } -func (r IdentityApiApiGetSessionRequest) Execute() (*Session, *http.Response, error) { +func (r IdentityApiGetSessionRequest) Execute() (*Session, *http.Response, error) { return r.ApiService.GetSessionExecute(r) } /* - - GetSession Get Session - - This endpoint is useful for: +GetSession Get Session + +This endpoint is useful for: Getting a session object with all specified expandables that exist in an administrative context. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID is the session's ID. - - @return IdentityApiApiGetSessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return IdentityApiGetSessionRequest */ -func (a *IdentityApiService) GetSession(ctx context.Context, id string) IdentityApiApiGetSessionRequest { - return IdentityApiApiGetSessionRequest{ +func (a *IdentityApiService) GetSession(ctx context.Context, id string) IdentityApiGetSessionRequest { + return IdentityApiGetSessionRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return Session - */ -func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest) (*Session, *http.Response, error) { +// Execute executes the request +// +// @return Session +func (a *IdentityApiService) GetSessionExecute(r IdentityApiGetSessionRequest) (*Session, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Session + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Session ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.GetSession") @@ -1950,7 +1954,7 @@ func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest } localVarPath := localBasePath + "/admin/sessions/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1961,10 +1965,10 @@ func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("expand", parameterToString(s.Index(i), "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "expand", s.Index(i).Interface(), "multi") } } else { - localVarQueryParams.Add("expand", parameterToString(t, "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "expand", t, "multi") } } // to determine the Content-Type header @@ -1998,7 +2002,7 @@ func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2027,6 +2031,7 @@ func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2036,6 +2041,7 @@ func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2052,7 +2058,7 @@ func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiListIdentitiesRequest struct { +type IdentityApiListIdentitiesRequest struct { ctx context.Context ApiService IdentityApi perPage *int64 @@ -2065,68 +2071,82 @@ type IdentityApiApiListIdentitiesRequest struct { previewCredentialsIdentifierSimilar *string } -func (r IdentityApiApiListIdentitiesRequest) PerPage(perPage int64) IdentityApiApiListIdentitiesRequest { +// Deprecated Items per Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This is the number of items per page. +func (r IdentityApiListIdentitiesRequest) PerPage(perPage int64) IdentityApiListIdentitiesRequest { r.perPage = &perPage return r } -func (r IdentityApiApiListIdentitiesRequest) Page(page int64) IdentityApiApiListIdentitiesRequest { + +// Deprecated Pagination Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the `Link` header. +func (r IdentityApiListIdentitiesRequest) Page(page int64) IdentityApiListIdentitiesRequest { r.page = &page return r } -func (r IdentityApiApiListIdentitiesRequest) PageSize(pageSize int64) IdentityApiApiListIdentitiesRequest { + +// Page Size This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListIdentitiesRequest) PageSize(pageSize int64) IdentityApiListIdentitiesRequest { r.pageSize = &pageSize return r } -func (r IdentityApiApiListIdentitiesRequest) PageToken(pageToken string) IdentityApiApiListIdentitiesRequest { + +// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListIdentitiesRequest) PageToken(pageToken string) IdentityApiListIdentitiesRequest { r.pageToken = &pageToken return r } -func (r IdentityApiApiListIdentitiesRequest) Consistency(consistency string) IdentityApiApiListIdentitiesRequest { + +// Read Consistency Level (preview) The read consistency level determines the consistency guarantee for reads: strong (slow): The read is guaranteed to return the most recent data committed at the start of the read. eventual (very fast): The result will return data that is about 4.8 seconds old. The default consistency guarantee can be changed in the Ory Network Console or using the Ory CLI with `ory patch project --replace '/previews/default_read_consistency_level=\"strong\"'`. Setting the default consistency level to `eventual` may cause regressions in the future as we add consistency controls to more APIs. Currently, the following APIs will be affected by this setting: `GET /admin/identities` This feature is in preview and only available in Ory Network. ConsistencyLevelUnset ConsistencyLevelUnset is the unset / default consistency level. strong ConsistencyLevelStrong ConsistencyLevelStrong is the strong consistency level. eventual ConsistencyLevelEventual ConsistencyLevelEventual is the eventual consistency level using follower read timestamps. +func (r IdentityApiListIdentitiesRequest) Consistency(consistency string) IdentityApiListIdentitiesRequest { r.consistency = &consistency return r } -func (r IdentityApiApiListIdentitiesRequest) Ids(ids []string) IdentityApiApiListIdentitiesRequest { + +// List of ids used to filter identities. If this list is empty, then no filter will be applied. +func (r IdentityApiListIdentitiesRequest) Ids(ids []string) IdentityApiListIdentitiesRequest { r.ids = &ids return r } -func (r IdentityApiApiListIdentitiesRequest) CredentialsIdentifier(credentialsIdentifier string) IdentityApiApiListIdentitiesRequest { + +// CredentialsIdentifier is the identifier (username, email) of the credentials to look up using exact match. Only one of CredentialsIdentifier and CredentialsIdentifierSimilar can be used. +func (r IdentityApiListIdentitiesRequest) CredentialsIdentifier(credentialsIdentifier string) IdentityApiListIdentitiesRequest { r.credentialsIdentifier = &credentialsIdentifier return r } -func (r IdentityApiApiListIdentitiesRequest) PreviewCredentialsIdentifierSimilar(previewCredentialsIdentifierSimilar string) IdentityApiApiListIdentitiesRequest { + +// This is an EXPERIMENTAL parameter that WILL CHANGE. Do NOT rely on consistent, deterministic behavior. THIS PARAMETER WILL BE REMOVED IN AN UPCOMING RELEASE WITHOUT ANY MIGRATION PATH. CredentialsIdentifierSimilar is the (partial) identifier (username, email) of the credentials to look up using similarity search. Only one of CredentialsIdentifier and CredentialsIdentifierSimilar can be used. +func (r IdentityApiListIdentitiesRequest) PreviewCredentialsIdentifierSimilar(previewCredentialsIdentifierSimilar string) IdentityApiListIdentitiesRequest { r.previewCredentialsIdentifierSimilar = &previewCredentialsIdentifierSimilar return r } -func (r IdentityApiApiListIdentitiesRequest) Execute() ([]Identity, *http.Response, error) { +func (r IdentityApiListIdentitiesRequest) Execute() ([]Identity, *http.Response, error) { return r.ApiService.ListIdentitiesExecute(r) } /* - * ListIdentities List Identities - * Lists all [identities](https://www.ory.sh/docs/kratos/concepts/identity-user-model) in the system. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiListIdentitiesRequest - */ -func (a *IdentityApiService) ListIdentities(ctx context.Context) IdentityApiApiListIdentitiesRequest { - return IdentityApiApiListIdentitiesRequest{ +ListIdentities List Identities + +Lists all [identities](https://www.ory.sh/docs/kratos/concepts/identity-user-model) in the system. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiListIdentitiesRequest +*/ +func (a *IdentityApiService) ListIdentities(ctx context.Context) IdentityApiListIdentitiesRequest { + return IdentityApiListIdentitiesRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return []Identity - */ -func (a *IdentityApiService) ListIdentitiesExecute(r IdentityApiApiListIdentitiesRequest) ([]Identity, *http.Response, error) { +// Execute executes the request +// +// @return []Identity +func (a *IdentityApiService) ListIdentitiesExecute(r IdentityApiListIdentitiesRequest) ([]Identity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []Identity + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Identity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.ListIdentities") @@ -2141,36 +2161,45 @@ func (a *IdentityApiService) ListIdentitiesExecute(r IdentityApiApiListIdentitie localVarFormParams := url.Values{} if r.perPage != nil { - localVarQueryParams.Add("per_page", parameterToString(*r.perPage, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } else { + var defaultValue int64 = 250 + r.perPage = &defaultValue } if r.page != nil { - localVarQueryParams.Add("page", parameterToString(*r.page, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") } if r.pageSize != nil { - localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "") + } else { + var defaultValue int64 = 250 + r.pageSize = &defaultValue } if r.pageToken != nil { - localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "") + } else { + var defaultValue string = "1" + r.pageToken = &defaultValue } if r.consistency != nil { - localVarQueryParams.Add("consistency", parameterToString(*r.consistency, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "consistency", r.consistency, "") } if r.ids != nil { t := *r.ids if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("ids", parameterToString(s.Index(i), "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "ids", s.Index(i).Interface(), "multi") } } else { - localVarQueryParams.Add("ids", parameterToString(t, "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "ids", t, "multi") } } if r.credentialsIdentifier != nil { - localVarQueryParams.Add("credentials_identifier", parameterToString(*r.credentialsIdentifier, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "credentials_identifier", r.credentialsIdentifier, "") } if r.previewCredentialsIdentifierSimilar != nil { - localVarQueryParams.Add("preview_credentials_identifier_similar", parameterToString(*r.previewCredentialsIdentifierSimilar, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "preview_credentials_identifier_similar", r.previewCredentialsIdentifierSimilar, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2203,7 +2232,7 @@ func (a *IdentityApiService) ListIdentitiesExecute(r IdentityApiApiListIdentitie } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2231,6 +2260,7 @@ func (a *IdentityApiService) ListIdentitiesExecute(r IdentityApiApiListIdentitie newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2247,7 +2277,7 @@ func (a *IdentityApiService) ListIdentitiesExecute(r IdentityApiApiListIdentitie return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiListIdentitySchemasRequest struct { +type IdentityApiListIdentitySchemasRequest struct { ctx context.Context ApiService IdentityApi perPage *int64 @@ -2256,52 +2286,58 @@ type IdentityApiApiListIdentitySchemasRequest struct { pageToken *string } -func (r IdentityApiApiListIdentitySchemasRequest) PerPage(perPage int64) IdentityApiApiListIdentitySchemasRequest { +// Deprecated Items per Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This is the number of items per page. +func (r IdentityApiListIdentitySchemasRequest) PerPage(perPage int64) IdentityApiListIdentitySchemasRequest { r.perPage = &perPage return r } -func (r IdentityApiApiListIdentitySchemasRequest) Page(page int64) IdentityApiApiListIdentitySchemasRequest { + +// Deprecated Pagination Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the `Link` header. +func (r IdentityApiListIdentitySchemasRequest) Page(page int64) IdentityApiListIdentitySchemasRequest { r.page = &page return r } -func (r IdentityApiApiListIdentitySchemasRequest) PageSize(pageSize int64) IdentityApiApiListIdentitySchemasRequest { + +// Page Size This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListIdentitySchemasRequest) PageSize(pageSize int64) IdentityApiListIdentitySchemasRequest { r.pageSize = &pageSize return r } -func (r IdentityApiApiListIdentitySchemasRequest) PageToken(pageToken string) IdentityApiApiListIdentitySchemasRequest { + +// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListIdentitySchemasRequest) PageToken(pageToken string) IdentityApiListIdentitySchemasRequest { r.pageToken = &pageToken return r } -func (r IdentityApiApiListIdentitySchemasRequest) Execute() ([]IdentitySchemaContainer, *http.Response, error) { +func (r IdentityApiListIdentitySchemasRequest) Execute() ([]IdentitySchemaContainer, *http.Response, error) { return r.ApiService.ListIdentitySchemasExecute(r) } /* - * ListIdentitySchemas Get all Identity Schemas - * Returns a list of all identity schemas currently in use. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiListIdentitySchemasRequest - */ -func (a *IdentityApiService) ListIdentitySchemas(ctx context.Context) IdentityApiApiListIdentitySchemasRequest { - return IdentityApiApiListIdentitySchemasRequest{ +ListIdentitySchemas Get all Identity Schemas + +Returns a list of all identity schemas currently in use. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiListIdentitySchemasRequest +*/ +func (a *IdentityApiService) ListIdentitySchemas(ctx context.Context) IdentityApiListIdentitySchemasRequest { + return IdentityApiListIdentitySchemasRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return []IdentitySchemaContainer - */ -func (a *IdentityApiService) ListIdentitySchemasExecute(r IdentityApiApiListIdentitySchemasRequest) ([]IdentitySchemaContainer, *http.Response, error) { +// Execute executes the request +// +// @return []IdentitySchemaContainer +func (a *IdentityApiService) ListIdentitySchemasExecute(r IdentityApiListIdentitySchemasRequest) ([]IdentitySchemaContainer, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []IdentitySchemaContainer + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []IdentitySchemaContainer ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.ListIdentitySchemas") @@ -2316,16 +2352,25 @@ func (a *IdentityApiService) ListIdentitySchemasExecute(r IdentityApiApiListIden localVarFormParams := url.Values{} if r.perPage != nil { - localVarQueryParams.Add("per_page", parameterToString(*r.perPage, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } else { + var defaultValue int64 = 250 + r.perPage = &defaultValue } if r.page != nil { - localVarQueryParams.Add("page", parameterToString(*r.page, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") } if r.pageSize != nil { - localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "") + } else { + var defaultValue int64 = 250 + r.pageSize = &defaultValue } if r.pageToken != nil { - localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "") + } else { + var defaultValue string = "1" + r.pageToken = &defaultValue } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2344,7 +2389,7 @@ func (a *IdentityApiService) ListIdentitySchemasExecute(r IdentityApiApiListIden if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2372,6 +2417,7 @@ func (a *IdentityApiService) ListIdentitySchemasExecute(r IdentityApiApiListIden newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2388,7 +2434,7 @@ func (a *IdentityApiService) ListIdentitySchemasExecute(r IdentityApiApiListIden return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiListIdentitySessionsRequest struct { +type IdentityApiListIdentitySessionsRequest struct { ctx context.Context ApiService IdentityApi id string @@ -2399,58 +2445,66 @@ type IdentityApiApiListIdentitySessionsRequest struct { active *bool } -func (r IdentityApiApiListIdentitySessionsRequest) PerPage(perPage int64) IdentityApiApiListIdentitySessionsRequest { +// Deprecated Items per Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This is the number of items per page. +func (r IdentityApiListIdentitySessionsRequest) PerPage(perPage int64) IdentityApiListIdentitySessionsRequest { r.perPage = &perPage return r } -func (r IdentityApiApiListIdentitySessionsRequest) Page(page int64) IdentityApiApiListIdentitySessionsRequest { + +// Deprecated Pagination Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the `Link` header. +func (r IdentityApiListIdentitySessionsRequest) Page(page int64) IdentityApiListIdentitySessionsRequest { r.page = &page return r } -func (r IdentityApiApiListIdentitySessionsRequest) PageSize(pageSize int64) IdentityApiApiListIdentitySessionsRequest { + +// Page Size This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListIdentitySessionsRequest) PageSize(pageSize int64) IdentityApiListIdentitySessionsRequest { r.pageSize = &pageSize return r } -func (r IdentityApiApiListIdentitySessionsRequest) PageToken(pageToken string) IdentityApiApiListIdentitySessionsRequest { + +// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListIdentitySessionsRequest) PageToken(pageToken string) IdentityApiListIdentitySessionsRequest { r.pageToken = &pageToken return r } -func (r IdentityApiApiListIdentitySessionsRequest) Active(active bool) IdentityApiApiListIdentitySessionsRequest { + +// Active is a boolean flag that filters out sessions based on the state. If no value is provided, all sessions are returned. +func (r IdentityApiListIdentitySessionsRequest) Active(active bool) IdentityApiListIdentitySessionsRequest { r.active = &active return r } -func (r IdentityApiApiListIdentitySessionsRequest) Execute() ([]Session, *http.Response, error) { +func (r IdentityApiListIdentitySessionsRequest) Execute() ([]Session, *http.Response, error) { return r.ApiService.ListIdentitySessionsExecute(r) } /* - * ListIdentitySessions List an Identity's Sessions - * This endpoint returns all sessions that belong to the given Identity. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the identity's ID. - * @return IdentityApiApiListIdentitySessionsRequest - */ -func (a *IdentityApiService) ListIdentitySessions(ctx context.Context, id string) IdentityApiApiListIdentitySessionsRequest { - return IdentityApiApiListIdentitySessionsRequest{ +ListIdentitySessions List an Identity's Sessions + +This endpoint returns all sessions that belong to the given Identity. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @return IdentityApiListIdentitySessionsRequest +*/ +func (a *IdentityApiService) ListIdentitySessions(ctx context.Context, id string) IdentityApiListIdentitySessionsRequest { + return IdentityApiListIdentitySessionsRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return []Session - */ -func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIdentitySessionsRequest) ([]Session, *http.Response, error) { +// Execute executes the request +// +// @return []Session +func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiListIdentitySessionsRequest) ([]Session, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []Session + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Session ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.ListIdentitySessions") @@ -2459,26 +2513,35 @@ func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIde } localVarPath := localBasePath + "/admin/identities/{id}/sessions" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.perPage != nil { - localVarQueryParams.Add("per_page", parameterToString(*r.perPage, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } else { + var defaultValue int64 = 250 + r.perPage = &defaultValue } if r.page != nil { - localVarQueryParams.Add("page", parameterToString(*r.page, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") } if r.pageSize != nil { - localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "") + } else { + var defaultValue int64 = 250 + r.pageSize = &defaultValue } if r.pageToken != nil { - localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "") + } else { + var defaultValue string = "1" + r.pageToken = &defaultValue } if r.active != nil { - localVarQueryParams.Add("active", parameterToString(*r.active, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "active", r.active, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2511,7 +2574,7 @@ func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIde } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2540,6 +2603,7 @@ func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIde newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2550,6 +2614,7 @@ func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIde newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2559,6 +2624,7 @@ func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIde newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2575,7 +2641,7 @@ func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIde return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiListSessionsRequest struct { +type IdentityApiListSessionsRequest struct { ctx context.Context ApiService IdentityApi pageSize *int64 @@ -2584,52 +2650,58 @@ type IdentityApiApiListSessionsRequest struct { expand *[]string } -func (r IdentityApiApiListSessionsRequest) PageSize(pageSize int64) IdentityApiApiListSessionsRequest { +// Items per Page This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListSessionsRequest) PageSize(pageSize int64) IdentityApiListSessionsRequest { r.pageSize = &pageSize return r } -func (r IdentityApiApiListSessionsRequest) PageToken(pageToken string) IdentityApiApiListSessionsRequest { + +// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListSessionsRequest) PageToken(pageToken string) IdentityApiListSessionsRequest { r.pageToken = &pageToken return r } -func (r IdentityApiApiListSessionsRequest) Active(active bool) IdentityApiApiListSessionsRequest { + +// Active is a boolean flag that filters out sessions based on the state. If no value is provided, all sessions are returned. +func (r IdentityApiListSessionsRequest) Active(active bool) IdentityApiListSessionsRequest { r.active = &active return r } -func (r IdentityApiApiListSessionsRequest) Expand(expand []string) IdentityApiApiListSessionsRequest { + +// ExpandOptions is a query parameter encoded list of all properties that must be expanded in the Session. If no value is provided, the expandable properties are skipped. +func (r IdentityApiListSessionsRequest) Expand(expand []string) IdentityApiListSessionsRequest { r.expand = &expand return r } -func (r IdentityApiApiListSessionsRequest) Execute() ([]Session, *http.Response, error) { +func (r IdentityApiListSessionsRequest) Execute() ([]Session, *http.Response, error) { return r.ApiService.ListSessionsExecute(r) } /* - * ListSessions List All Sessions - * Listing all sessions that exist. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiListSessionsRequest - */ -func (a *IdentityApiService) ListSessions(ctx context.Context) IdentityApiApiListSessionsRequest { - return IdentityApiApiListSessionsRequest{ +ListSessions List All Sessions + +Listing all sessions that exist. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiListSessionsRequest +*/ +func (a *IdentityApiService) ListSessions(ctx context.Context) IdentityApiListSessionsRequest { + return IdentityApiListSessionsRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return []Session - */ -func (a *IdentityApiService) ListSessionsExecute(r IdentityApiApiListSessionsRequest) ([]Session, *http.Response, error) { +// Execute executes the request +// +// @return []Session +func (a *IdentityApiService) ListSessionsExecute(r IdentityApiListSessionsRequest) ([]Session, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []Session + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Session ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.ListSessions") @@ -2644,23 +2716,26 @@ func (a *IdentityApiService) ListSessionsExecute(r IdentityApiApiListSessionsReq localVarFormParams := url.Values{} if r.pageSize != nil { - localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "") + } else { + var defaultValue int64 = 250 + r.pageSize = &defaultValue } if r.pageToken != nil { - localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "") } if r.active != nil { - localVarQueryParams.Add("active", parameterToString(*r.active, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "active", r.active, "") } if r.expand != nil { t := *r.expand if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("expand", parameterToString(s.Index(i), "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "expand", s.Index(i).Interface(), "multi") } } else { - localVarQueryParams.Add("expand", parameterToString(t, "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "expand", t, "multi") } } // to determine the Content-Type header @@ -2694,7 +2769,7 @@ func (a *IdentityApiService) ListSessionsExecute(r IdentityApiApiListSessionsReq } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2723,6 +2798,7 @@ func (a *IdentityApiService) ListSessionsExecute(r IdentityApiApiListSessionsReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2732,6 +2808,7 @@ func (a *IdentityApiService) ListSessionsExecute(r IdentityApiApiListSessionsReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2748,51 +2825,49 @@ func (a *IdentityApiService) ListSessionsExecute(r IdentityApiApiListSessionsReq return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiPatchIdentityRequest struct { +type IdentityApiPatchIdentityRequest struct { ctx context.Context ApiService IdentityApi id string jsonPatch *[]JsonPatch } -func (r IdentityApiApiPatchIdentityRequest) JsonPatch(jsonPatch []JsonPatch) IdentityApiApiPatchIdentityRequest { +func (r IdentityApiPatchIdentityRequest) JsonPatch(jsonPatch []JsonPatch) IdentityApiPatchIdentityRequest { r.jsonPatch = &jsonPatch return r } -func (r IdentityApiApiPatchIdentityRequest) Execute() (*Identity, *http.Response, error) { +func (r IdentityApiPatchIdentityRequest) Execute() (*Identity, *http.Response, error) { return r.ApiService.PatchIdentityExecute(r) } /* - - PatchIdentity Patch an Identity - - Partially updates an [identity's](https://www.ory.sh/docs/kratos/concepts/identity-user-model) field using [JSON Patch](https://jsonpatch.com/). +PatchIdentity Patch an Identity +Partially updates an [identity's](https://www.ory.sh/docs/kratos/concepts/identity-user-model) field using [JSON Patch](https://jsonpatch.com/). The fields `id`, `stateChangedAt` and `credentials` can not be updated using this method. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID must be set to the ID of identity you want to update - - @return IdentityApiApiPatchIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of identity you want to update + @return IdentityApiPatchIdentityRequest */ -func (a *IdentityApiService) PatchIdentity(ctx context.Context, id string) IdentityApiApiPatchIdentityRequest { - return IdentityApiApiPatchIdentityRequest{ +func (a *IdentityApiService) PatchIdentity(ctx context.Context, id string) IdentityApiPatchIdentityRequest { + return IdentityApiPatchIdentityRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return Identity - */ -func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityRequest) (*Identity, *http.Response, error) { +// Execute executes the request +// +// @return Identity +func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiPatchIdentityRequest) (*Identity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPatch - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Identity + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Identity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.PatchIdentity") @@ -2801,7 +2876,7 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR } localVarPath := localBasePath + "/admin/identities/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2840,7 +2915,7 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2869,6 +2944,7 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2879,6 +2955,7 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2889,6 +2966,7 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2898,6 +2976,7 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2914,51 +2993,49 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiUpdateIdentityRequest struct { +type IdentityApiUpdateIdentityRequest struct { ctx context.Context ApiService IdentityApi id string updateIdentityBody *UpdateIdentityBody } -func (r IdentityApiApiUpdateIdentityRequest) UpdateIdentityBody(updateIdentityBody UpdateIdentityBody) IdentityApiApiUpdateIdentityRequest { +func (r IdentityApiUpdateIdentityRequest) UpdateIdentityBody(updateIdentityBody UpdateIdentityBody) IdentityApiUpdateIdentityRequest { r.updateIdentityBody = &updateIdentityBody return r } -func (r IdentityApiApiUpdateIdentityRequest) Execute() (*Identity, *http.Response, error) { +func (r IdentityApiUpdateIdentityRequest) Execute() (*Identity, *http.Response, error) { return r.ApiService.UpdateIdentityExecute(r) } /* - - UpdateIdentity Update an Identity - - This endpoint updates an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). The full identity +UpdateIdentity Update an Identity +This endpoint updates an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). The full identity payload (except credentials) is expected. It is possible to update the identity's credentials as well. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID must be set to the ID of identity you want to update - - @return IdentityApiApiUpdateIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of identity you want to update + @return IdentityApiUpdateIdentityRequest */ -func (a *IdentityApiService) UpdateIdentity(ctx context.Context, id string) IdentityApiApiUpdateIdentityRequest { - return IdentityApiApiUpdateIdentityRequest{ +func (a *IdentityApiService) UpdateIdentity(ctx context.Context, id string) IdentityApiUpdateIdentityRequest { + return IdentityApiUpdateIdentityRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return Identity - */ -func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentityRequest) (*Identity, *http.Response, error) { +// Execute executes the request +// +// @return Identity +func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiUpdateIdentityRequest) (*Identity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPut - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Identity + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Identity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.UpdateIdentity") @@ -2967,7 +3044,7 @@ func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentit } localVarPath := localBasePath + "/admin/identities/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -3006,7 +3083,7 @@ func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentit } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3035,6 +3112,7 @@ func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3045,6 +3123,7 @@ func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3055,6 +3134,7 @@ func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3064,6 +3144,7 @@ func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/internal/client-go/api_metadata.go b/internal/client-go/api_metadata.go index 0ea297189e2f..59d7f9bae818 100644 --- a/internal/client-go/api_metadata.go +++ b/internal/client-go/api_metadata.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,36 +19,32 @@ import ( "net/url" ) -// Linger please -var ( - _ context.Context -) - type MetadataApi interface { /* - * GetVersion Return Running Software Version. - * This endpoint returns the version of Ory Kratos. + GetVersion Return Running Software Version. + + This endpoint returns the version of Ory Kratos. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the version will never refer to the cluster state, only to a single instance. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return MetadataApiApiGetVersionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MetadataApiGetVersionRequest */ - GetVersion(ctx context.Context) MetadataApiApiGetVersionRequest + GetVersion(ctx context.Context) MetadataApiGetVersionRequest - /* - * GetVersionExecute executes the request - * @return GetVersion200Response - */ - GetVersionExecute(r MetadataApiApiGetVersionRequest) (*GetVersion200Response, *http.Response, error) + // GetVersionExecute executes the request + // @return GetVersion200Response + GetVersionExecute(r MetadataApiGetVersionRequest) (*GetVersion200Response, *http.Response, error) /* - * IsAlive Check HTTP Server Status - * This endpoint returns a HTTP 200 status code when Ory Kratos is accepting incoming + IsAlive Check HTTP Server Status + + This endpoint returns a HTTP 200 status code when Ory Kratos is accepting incoming HTTP requests. This status does currently not include checks whether the database connection is working. If the service supports TLS Edge Termination, this endpoint does not require the @@ -56,20 +52,20 @@ type MetadataApi interface { Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return MetadataApiApiIsAliveRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MetadataApiIsAliveRequest */ - IsAlive(ctx context.Context) MetadataApiApiIsAliveRequest + IsAlive(ctx context.Context) MetadataApiIsAliveRequest - /* - * IsAliveExecute executes the request - * @return IsAlive200Response - */ - IsAliveExecute(r MetadataApiApiIsAliveRequest) (*IsAlive200Response, *http.Response, error) + // IsAliveExecute executes the request + // @return IsAlive200Response + IsAliveExecute(r MetadataApiIsAliveRequest) (*IsAlive200Response, *http.Response, error) /* - * IsReady Check HTTP Server and Database Status - * This endpoint returns a HTTP 200 status code when Ory Kratos is up running and the environment dependencies (e.g. + IsReady Check HTTP Server and Database Status + + This endpoint returns a HTTP 200 status code when Ory Kratos is up running and the environment dependencies (e.g. the database) are responsive as well. If the service supports TLS Edge Termination, this endpoint does not require the @@ -77,61 +73,59 @@ type MetadataApi interface { Be aware that if you are running multiple nodes of Ory Kratos, the health status will never refer to the cluster state, only to a single instance. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return MetadataApiApiIsReadyRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MetadataApiIsReadyRequest */ - IsReady(ctx context.Context) MetadataApiApiIsReadyRequest + IsReady(ctx context.Context) MetadataApiIsReadyRequest - /* - * IsReadyExecute executes the request - * @return IsAlive200Response - */ - IsReadyExecute(r MetadataApiApiIsReadyRequest) (*IsAlive200Response, *http.Response, error) + // IsReadyExecute executes the request + // @return IsAlive200Response + IsReadyExecute(r MetadataApiIsReadyRequest) (*IsAlive200Response, *http.Response, error) } // MetadataApiService MetadataApi service type MetadataApiService service -type MetadataApiApiGetVersionRequest struct { +type MetadataApiGetVersionRequest struct { ctx context.Context ApiService MetadataApi } -func (r MetadataApiApiGetVersionRequest) Execute() (*GetVersion200Response, *http.Response, error) { +func (r MetadataApiGetVersionRequest) Execute() (*GetVersion200Response, *http.Response, error) { return r.ApiService.GetVersionExecute(r) } /* - - GetVersion Return Running Software Version. - - This endpoint returns the version of Ory Kratos. +GetVersion Return Running Software Version. + +This endpoint returns the version of Ory Kratos. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the version will never refer to the cluster state, only to a single instance. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return MetadataApiApiGetVersionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MetadataApiGetVersionRequest */ -func (a *MetadataApiService) GetVersion(ctx context.Context) MetadataApiApiGetVersionRequest { - return MetadataApiApiGetVersionRequest{ +func (a *MetadataApiService) GetVersion(ctx context.Context) MetadataApiGetVersionRequest { + return MetadataApiGetVersionRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return GetVersion200Response - */ -func (a *MetadataApiService) GetVersionExecute(r MetadataApiApiGetVersionRequest) (*GetVersion200Response, *http.Response, error) { +// Execute executes the request +// +// @return GetVersion200Response +func (a *MetadataApiService) GetVersionExecute(r MetadataApiGetVersionRequest) (*GetVersion200Response, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *GetVersion200Response + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetVersion200Response ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetadataApiService.GetVersion") @@ -162,7 +156,7 @@ func (a *MetadataApiService) GetVersionExecute(r MetadataApiApiGetVersionRequest if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -199,19 +193,19 @@ func (a *MetadataApiService) GetVersionExecute(r MetadataApiApiGetVersionRequest return localVarReturnValue, localVarHTTPResponse, nil } -type MetadataApiApiIsAliveRequest struct { +type MetadataApiIsAliveRequest struct { ctx context.Context ApiService MetadataApi } -func (r MetadataApiApiIsAliveRequest) Execute() (*IsAlive200Response, *http.Response, error) { +func (r MetadataApiIsAliveRequest) Execute() (*IsAlive200Response, *http.Response, error) { return r.ApiService.IsAliveExecute(r) } /* - - IsAlive Check HTTP Server Status - - This endpoint returns a HTTP 200 status code when Ory Kratos is accepting incoming +IsAlive Check HTTP Server Status +This endpoint returns a HTTP 200 status code when Ory Kratos is accepting incoming HTTP requests. This status does currently not include checks whether the database connection is working. If the service supports TLS Edge Termination, this endpoint does not require the @@ -219,28 +213,26 @@ If the service supports TLS Edge Termination, this endpoint does not require the Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return MetadataApiApiIsAliveRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MetadataApiIsAliveRequest */ -func (a *MetadataApiService) IsAlive(ctx context.Context) MetadataApiApiIsAliveRequest { - return MetadataApiApiIsAliveRequest{ +func (a *MetadataApiService) IsAlive(ctx context.Context) MetadataApiIsAliveRequest { + return MetadataApiIsAliveRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return IsAlive200Response - */ -func (a *MetadataApiService) IsAliveExecute(r MetadataApiApiIsAliveRequest) (*IsAlive200Response, *http.Response, error) { +// Execute executes the request +// +// @return IsAlive200Response +func (a *MetadataApiService) IsAliveExecute(r MetadataApiIsAliveRequest) (*IsAlive200Response, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *IsAlive200Response + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IsAlive200Response ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetadataApiService.IsAlive") @@ -271,7 +263,7 @@ func (a *MetadataApiService) IsAliveExecute(r MetadataApiApiIsAliveRequest) (*Is if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -299,6 +291,7 @@ func (a *MetadataApiService) IsAliveExecute(r MetadataApiApiIsAliveRequest) (*Is newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -315,19 +308,19 @@ func (a *MetadataApiService) IsAliveExecute(r MetadataApiApiIsAliveRequest) (*Is return localVarReturnValue, localVarHTTPResponse, nil } -type MetadataApiApiIsReadyRequest struct { +type MetadataApiIsReadyRequest struct { ctx context.Context ApiService MetadataApi } -func (r MetadataApiApiIsReadyRequest) Execute() (*IsAlive200Response, *http.Response, error) { +func (r MetadataApiIsReadyRequest) Execute() (*IsAlive200Response, *http.Response, error) { return r.ApiService.IsReadyExecute(r) } /* - - IsReady Check HTTP Server and Database Status - - This endpoint returns a HTTP 200 status code when Ory Kratos is up running and the environment dependencies (e.g. +IsReady Check HTTP Server and Database Status +This endpoint returns a HTTP 200 status code when Ory Kratos is up running and the environment dependencies (e.g. the database) are responsive as well. If the service supports TLS Edge Termination, this endpoint does not require the @@ -335,28 +328,26 @@ If the service supports TLS Edge Termination, this endpoint does not require the Be aware that if you are running multiple nodes of Ory Kratos, the health status will never refer to the cluster state, only to a single instance. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return MetadataApiApiIsReadyRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MetadataApiIsReadyRequest */ -func (a *MetadataApiService) IsReady(ctx context.Context) MetadataApiApiIsReadyRequest { - return MetadataApiApiIsReadyRequest{ +func (a *MetadataApiService) IsReady(ctx context.Context) MetadataApiIsReadyRequest { + return MetadataApiIsReadyRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return IsAlive200Response - */ -func (a *MetadataApiService) IsReadyExecute(r MetadataApiApiIsReadyRequest) (*IsAlive200Response, *http.Response, error) { +// Execute executes the request +// +// @return IsAlive200Response +func (a *MetadataApiService) IsReadyExecute(r MetadataApiIsReadyRequest) (*IsAlive200Response, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *IsAlive200Response + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IsAlive200Response ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetadataApiService.IsReady") @@ -387,7 +378,7 @@ func (a *MetadataApiService) IsReadyExecute(r MetadataApiApiIsReadyRequest) (*Is if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -416,6 +407,7 @@ func (a *MetadataApiService) IsReadyExecute(r MetadataApiApiIsReadyRequest) (*Is newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -425,6 +417,7 @@ func (a *MetadataApiService) IsReadyExecute(r MetadataApiApiIsReadyRequest) (*Is newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/internal/client-go/client.go b/internal/client-go/client.go index 949a0e51ab35..f6fb9804269f 100644 --- a/internal/client-go/client.go +++ b/internal/client-go/client.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -32,13 +32,13 @@ import ( "strings" "time" "unicode/utf8" - - "golang.org/x/oauth2" ) var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) - xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") ) // APIClient manages communication with the Ory Identities API API v @@ -110,10 +110,10 @@ func selectHeaderAccept(accepts []string) string { return strings.Join(accepts, ",") } -// contains is a case insenstive match, finding needle in a haystack +// contains is a case insensitive match, finding needle in a haystack func contains(haystack []string, needle string) bool { for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { + if strings.EqualFold(a, needle) { return true } } @@ -129,33 +129,111 @@ func typeCheckParameter(obj interface{}, expected string, name string) error { // Check the type is as expected. if reflect.TypeOf(obj).String() != expected { - return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) } return nil } -// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. -func parameterToString(obj interface{}, collectionFormat string) string { - var delimiter string - - switch collectionFormat { - case "pipes": - delimiter = "|" - case "ssv": - delimiter = " " - case "tsv": - delimiter = "\t" - case "csv": - delimiter = "," +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return - if reflect.TypeOf(obj).Kind() == reflect.Slice { - return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") - } else if t, ok := obj.(time.Time); ok { - return t.Format(time.RFC3339) + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } } - return fmt.Sprintf("%v", obj) + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } } // helper for converting interface{} parameters to json strings @@ -198,6 +276,12 @@ func (c *APIClient) GetConfig() *Configuration { return c.cfg } +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + // prepareRequest build the request func (c *APIClient) prepareRequest( ctx context.Context, @@ -206,9 +290,7 @@ func (c *APIClient) prepareRequest( headerParams map[string]string, queryParams url.Values, formParams url.Values, - formFileName string, - fileName string, - fileBytes []byte) (localVarRequest *http.Request, err error) { + formFiles []formFile) (localVarRequest *http.Request, err error) { var body *bytes.Buffer @@ -227,7 +309,7 @@ func (c *APIClient) prepareRequest( } // add form parameters and file if available. - if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { if body != nil { return nil, errors.New("Cannot specify postBody and multipart form at the same time.") } @@ -246,16 +328,17 @@ func (c *APIClient) prepareRequest( } } } - if len(fileBytes) > 0 && fileName != "" { - w.Boundary() - //_, fileNm := filepath.Split(fileName) - part, err := w.CreateFormFile(formFileName, filepath.Base(fileName)) - if err != nil { - return nil, err - } - _, err = part.Write(fileBytes) - if err != nil { - return nil, err + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } } } @@ -302,7 +385,11 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = query.Encode() + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) // Generate a new request if body != nil { @@ -318,7 +405,7 @@ func (c *APIClient) prepareRequest( if len(headerParams) > 0 { headers := http.Header{} for h, v := range headerParams { - headers.Set(h, v) + headers[h] = []string{v} } localVarRequest.Header = headers } @@ -332,27 +419,6 @@ func (c *APIClient) prepareRequest( // Walk through any authentication. - // OAuth2 authentication - if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { - // We were able to grab an oauth2 token from the context - var latestToken *oauth2.Token - if latestToken, err = tok.Token(); err != nil { - return nil, err - } - - latestToken.SetAuthHeader(localVarRequest) - } - - // Basic HTTP Authentication - if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { - localVarRequest.SetBasicAuth(auth.UserName, auth.Password) - } - - // AccessToken Authentication - if auth, ok := ctx.Value(ContextAccessToken).(string); ok { - localVarRequest.Header.Add("Authorization", "Bearer "+auth) - } - } for header, value := range c.cfg.DefaultHeader { @@ -369,13 +435,37 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err *s = string(b) return nil } - if xmlCheck.MatchString(contentType) { + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { if err = xml.Unmarshal(b, v); err != nil { return err } return nil } - if jsonCheck.MatchString(contentType) { + if JsonCheck.MatchString(contentType) { if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined if err = unmarshalObj.UnmarshalJSON(b); err != nil { @@ -394,11 +484,14 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err // Add a file to the multipart request func addFile(w *multipart.Writer, fieldName, path string) error { - file, err := os.Open(path) + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() if err != nil { return err } - defer file.Close() part, err := w.CreateFormFile(fieldName, filepath.Base(path)) if err != nil { @@ -414,7 +507,7 @@ func reportError(format string, a ...interface{}) error { return fmt.Errorf(format, a...) } -// Prevent trying to import "bytes" +// A wrapper for strict JSON decoding func newStrictDecoder(data []byte) *json.Decoder { dec := json.NewDecoder(bytes.NewBuffer(data)) dec.DisallowUnknownFields() @@ -429,16 +522,22 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e if reader, ok := body.(io.Reader); ok { _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) } else if b, ok := body.([]byte); ok { _, err = bodyBuf.Write(b) } else if s, ok := body.(string); ok { _, err = bodyBuf.WriteString(s) } else if s, ok := body.(*string); ok { _, err = bodyBuf.WriteString(*s) - } else if jsonCheck.MatchString(contentType) { + } else if JsonCheck.MatchString(contentType) { err = json.NewEncoder(bodyBuf).Encode(body) - } else if xmlCheck.MatchString(contentType) { - err = xml.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } } if err != nil { @@ -446,7 +545,7 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e } if bodyBuf.Len() == 0 { - err = fmt.Errorf("Invalid body type %s\n", contentType) + err = fmt.Errorf("invalid body type %s\n", contentType) return nil, err } return bodyBuf, nil @@ -548,3 +647,23 @@ func (e GenericOpenAPIError) Body() []byte { func (e GenericOpenAPIError) Model() interface{} { return e.model } + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/internal/client-go/configuration.go b/internal/client-go/configuration.go index 4c5de2bb48b3..c383daa24694 100644 --- a/internal/client-go/configuration.go +++ b/internal/client-go/configuration.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -29,21 +29,9 @@ func (c contextKey) String() string { } var ( - // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. - ContextOAuth2 = contextKey("token") - - // ContextBasicAuth takes BasicAuth as authentication for the request. - ContextBasicAuth = contextKey("basic") - - // ContextAccessToken takes a string oauth2 access token as authentication for the request. - ContextAccessToken = contextKey("accesstoken") - // ContextAPIKeys takes a string apikey as authentication for the request ContextAPIKeys = contextKey("apiKeys") - // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. - ContextHttpSignatureAuth = contextKey("httpsignature") - // ContextServerIndex uses a server configuration from the index. ContextServerIndex = contextKey("serverIndex") @@ -123,7 +111,7 @@ func (c *Configuration) AddDefaultHeader(key string, value string) { // URL formats template on a index using given variables func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { if index < 0 || len(sc) <= index { - return "", fmt.Errorf("Index %v out of range %v", index, len(sc)-1) + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) } server := sc[index] url := server.URL @@ -138,7 +126,7 @@ func (sc ServerConfigurations) URL(index int, variables map[string]string) (stri } } if !found { - return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) } url = strings.Replace(url, "{"+name+"}", value, -1) } else { diff --git a/internal/client-go/git_push.sh b/internal/client-go/git_push.sh index ba5bdb84d95d..b036751d4a18 100644 --- a/internal/client-go/git_push.sh +++ b/internal/client-go/git_push.sh @@ -1,7 +1,7 @@ #!/bin/sh # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 @@ -38,14 +38,14 @@ git add . git commit -m "$release_note" # Sets the new remote -git_remote=`git remote` +git_remote=$(git remote) if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git fi fi @@ -55,4 +55,3 @@ git pull origin master # Pushes (Forces) the changes in the local repository up to the remote repository echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https' - diff --git a/internal/client-go/go.mod b/internal/client-go/go.mod index 8fb474b65966..6e768c9e5067 100644 --- a/internal/client-go/go.mod +++ b/internal/client-go/go.mod @@ -1,5 +1,3 @@ module github.com/ory/client-go -go 1.13 - -require golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 +go 1.18 diff --git a/internal/client-go/model_authenticator_assurance_level.go b/internal/client-go/model_authenticator_assurance_level.go index e6def4dfe3d8..08e0714cf5f0 100644 --- a/internal/client-go/model_authenticator_assurance_level.go +++ b/internal/client-go/model_authenticator_assurance_level.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -27,6 +27,14 @@ const ( AUTHENTICATORASSURANCELEVEL_AAL3 AuthenticatorAssuranceLevel = "aal3" ) +// All allowed values of AuthenticatorAssuranceLevel enum +var AllowedAuthenticatorAssuranceLevelEnumValues = []AuthenticatorAssuranceLevel{ + "aal0", + "aal1", + "aal2", + "aal3", +} + func (v *AuthenticatorAssuranceLevel) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -34,7 +42,7 @@ func (v *AuthenticatorAssuranceLevel) UnmarshalJSON(src []byte) error { return err } enumTypeValue := AuthenticatorAssuranceLevel(value) - for _, existing := range []AuthenticatorAssuranceLevel{"aal0", "aal1", "aal2", "aal3"} { + for _, existing := range AllowedAuthenticatorAssuranceLevelEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -44,6 +52,27 @@ func (v *AuthenticatorAssuranceLevel) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid AuthenticatorAssuranceLevel", value) } +// NewAuthenticatorAssuranceLevelFromValue returns a pointer to a valid AuthenticatorAssuranceLevel +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewAuthenticatorAssuranceLevelFromValue(v string) (*AuthenticatorAssuranceLevel, error) { + ev := AuthenticatorAssuranceLevel(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for AuthenticatorAssuranceLevel: valid values are %v", v, AllowedAuthenticatorAssuranceLevelEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v AuthenticatorAssuranceLevel) IsValid() bool { + for _, existing := range AllowedAuthenticatorAssuranceLevelEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to authenticatorAssuranceLevel value func (v AuthenticatorAssuranceLevel) Ptr() *AuthenticatorAssuranceLevel { return &v diff --git a/internal/client-go/model_batch_patch_identities_response.go b/internal/client-go/model_batch_patch_identities_response.go index 4ddeea9f7898..abf475d9e771 100644 --- a/internal/client-go/model_batch_patch_identities_response.go +++ b/internal/client-go/model_batch_patch_identities_response.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the BatchPatchIdentitiesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BatchPatchIdentitiesResponse{} + // BatchPatchIdentitiesResponse Patch identities response type BatchPatchIdentitiesResponse struct { // The patch responses for the individual identities. @@ -40,7 +43,7 @@ func NewBatchPatchIdentitiesResponseWithDefaults() *BatchPatchIdentitiesResponse // GetIdentities returns the Identities field value if set, zero value otherwise. func (o *BatchPatchIdentitiesResponse) GetIdentities() []IdentityPatchResponse { - if o == nil || o.Identities == nil { + if o == nil || IsNil(o.Identities) { var ret []IdentityPatchResponse return ret } @@ -50,7 +53,7 @@ func (o *BatchPatchIdentitiesResponse) GetIdentities() []IdentityPatchResponse { // GetIdentitiesOk returns a tuple with the Identities field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BatchPatchIdentitiesResponse) GetIdentitiesOk() ([]IdentityPatchResponse, bool) { - if o == nil || o.Identities == nil { + if o == nil || IsNil(o.Identities) { return nil, false } return o.Identities, true @@ -58,7 +61,7 @@ func (o *BatchPatchIdentitiesResponse) GetIdentitiesOk() ([]IdentityPatchRespons // HasIdentities returns a boolean if a field has been set. func (o *BatchPatchIdentitiesResponse) HasIdentities() bool { - if o != nil && o.Identities != nil { + if o != nil && !IsNil(o.Identities) { return true } @@ -71,11 +74,19 @@ func (o *BatchPatchIdentitiesResponse) SetIdentities(v []IdentityPatchResponse) } func (o BatchPatchIdentitiesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BatchPatchIdentitiesResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Identities != nil { + if !IsNil(o.Identities) { toSerialize["identities"] = o.Identities } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableBatchPatchIdentitiesResponse struct { diff --git a/internal/client-go/model_consistency_request_parameters.go b/internal/client-go/model_consistency_request_parameters.go index 6c48a4d6bb47..c625e83f3b04 100644 --- a/internal/client-go/model_consistency_request_parameters.go +++ b/internal/client-go/model_consistency_request_parameters.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the ConsistencyRequestParameters type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConsistencyRequestParameters{} + // ConsistencyRequestParameters Control API consistency guarantees type ConsistencyRequestParameters struct { // Read Consistency Level (preview) The read consistency level determines the consistency guarantee for reads: strong (slow): The read is guaranteed to return the most recent data committed at the start of the read. eventual (very fast): The result will return data that is about 4.8 seconds old. The default consistency guarantee can be changed in the Ory Network Console or using the Ory CLI with `ory patch project --replace '/previews/default_read_consistency_level=\"strong\"'`. Setting the default consistency level to `eventual` may cause regressions in the future as we add consistency controls to more APIs. Currently, the following APIs will be affected by this setting: `GET /admin/identities` This feature is in preview and only available in Ory Network. ConsistencyLevelUnset ConsistencyLevelUnset is the unset / default consistency level. strong ConsistencyLevelStrong ConsistencyLevelStrong is the strong consistency level. eventual ConsistencyLevelEventual ConsistencyLevelEventual is the eventual consistency level using follower read timestamps. @@ -40,7 +43,7 @@ func NewConsistencyRequestParametersWithDefaults() *ConsistencyRequestParameters // GetConsistency returns the Consistency field value if set, zero value otherwise. func (o *ConsistencyRequestParameters) GetConsistency() string { - if o == nil || o.Consistency == nil { + if o == nil || IsNil(o.Consistency) { var ret string return ret } @@ -50,7 +53,7 @@ func (o *ConsistencyRequestParameters) GetConsistency() string { // GetConsistencyOk returns a tuple with the Consistency field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ConsistencyRequestParameters) GetConsistencyOk() (*string, bool) { - if o == nil || o.Consistency == nil { + if o == nil || IsNil(o.Consistency) { return nil, false } return o.Consistency, true @@ -58,7 +61,7 @@ func (o *ConsistencyRequestParameters) GetConsistencyOk() (*string, bool) { // HasConsistency returns a boolean if a field has been set. func (o *ConsistencyRequestParameters) HasConsistency() bool { - if o != nil && o.Consistency != nil { + if o != nil && !IsNil(o.Consistency) { return true } @@ -71,11 +74,19 @@ func (o *ConsistencyRequestParameters) SetConsistency(v string) { } func (o ConsistencyRequestParameters) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConsistencyRequestParameters) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Consistency != nil { + if !IsNil(o.Consistency) { toSerialize["consistency"] = o.Consistency } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableConsistencyRequestParameters struct { diff --git a/internal/client-go/model_continue_with.go b/internal/client-go/model_continue_with.go index a81558a8d53d..f588824f0734 100644 --- a/internal/client-go/model_continue_with.go +++ b/internal/client-go/model_continue_with.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -31,7 +31,7 @@ func (dst *ContinueWith) UnmarshalJSON(data []byte) error { var jsonDict map[string]interface{} err = json.Unmarshal(data, &jsonDict) if err != nil { - return fmt.Errorf("Failed to unmarshal JSON into map for the discrimintor lookup.") + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") } // check if the discriminator value is 'set_ory_session_token' @@ -214,7 +214,7 @@ func (dst *ContinueWith) UnmarshalJSON(data []byte) error { dst.ContinueWithVerificationUi = nil } - return fmt.Errorf("Data failed to match schemas in anyOf(ContinueWith)") + return fmt.Errorf("data failed to match schemas in anyOf(ContinueWith)") } // Marshal data from the first non-nil pointers in the struct to JSON diff --git a/internal/client-go/model_continue_with_recovery_ui.go b/internal/client-go/model_continue_with_recovery_ui.go index 808b5c63156a..a7423e60a72c 100644 --- a/internal/client-go/model_continue_with_recovery_ui.go +++ b/internal/client-go/model_continue_with_recovery_ui.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithRecoveryUi type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithRecoveryUi{} + // ContinueWithRecoveryUi Indicates, that the UI flow could be continued by showing a recovery ui type ContinueWithRecoveryUi struct { // Action will always be `show_recovery_ui` set_ory_session_token ContinueWithActionSetOrySessionTokenString show_verification_ui ContinueWithActionShowVerificationUIString show_settings_ui ContinueWithActionShowSettingsUIString show_recovery_ui ContinueWithActionShowRecoveryUIString @@ -22,6 +27,8 @@ type ContinueWithRecoveryUi struct { Flow *ContinueWithRecoveryUiFlow `json:"flow,omitempty"` } +type _ContinueWithRecoveryUi ContinueWithRecoveryUi + // NewContinueWithRecoveryUi instantiates a new ContinueWithRecoveryUi object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -66,7 +73,7 @@ func (o *ContinueWithRecoveryUi) SetAction(v string) { // GetFlow returns the Flow field value if set, zero value otherwise. func (o *ContinueWithRecoveryUi) GetFlow() ContinueWithRecoveryUiFlow { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { var ret ContinueWithRecoveryUiFlow return ret } @@ -76,7 +83,7 @@ func (o *ContinueWithRecoveryUi) GetFlow() ContinueWithRecoveryUiFlow { // GetFlowOk returns a tuple with the Flow field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ContinueWithRecoveryUi) GetFlowOk() (*ContinueWithRecoveryUiFlow, bool) { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { return nil, false } return o.Flow, true @@ -84,7 +91,7 @@ func (o *ContinueWithRecoveryUi) GetFlowOk() (*ContinueWithRecoveryUiFlow, bool) // HasFlow returns a boolean if a field has been set. func (o *ContinueWithRecoveryUi) HasFlow() bool { - if o != nil && o.Flow != nil { + if o != nil && !IsNil(o.Flow) { return true } @@ -97,14 +104,57 @@ func (o *ContinueWithRecoveryUi) SetFlow(v ContinueWithRecoveryUiFlow) { } func (o ContinueWithRecoveryUi) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["action"] = o.Action + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Flow != nil { + return json.Marshal(toSerialize) +} + +func (o ContinueWithRecoveryUi) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["action"] = o.Action + if !IsNil(o.Flow) { toSerialize["flow"] = o.Flow } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *ContinueWithRecoveryUi) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "action", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithRecoveryUi := _ContinueWithRecoveryUi{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithRecoveryUi) + + if err != nil { + return err + } + + *o = ContinueWithRecoveryUi(varContinueWithRecoveryUi) + + return err } type NullableContinueWithRecoveryUi struct { diff --git a/internal/client-go/model_continue_with_recovery_ui_flow.go b/internal/client-go/model_continue_with_recovery_ui_flow.go index 3fde7e717ef2..e7852dd053fe 100644 --- a/internal/client-go/model_continue_with_recovery_ui_flow.go +++ b/internal/client-go/model_continue_with_recovery_ui_flow.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithRecoveryUiFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithRecoveryUiFlow{} + // ContinueWithRecoveryUiFlow struct for ContinueWithRecoveryUiFlow type ContinueWithRecoveryUiFlow struct { // The ID of the recovery flow @@ -23,6 +28,8 @@ type ContinueWithRecoveryUiFlow struct { Url *string `json:"url,omitempty"` } +type _ContinueWithRecoveryUiFlow ContinueWithRecoveryUiFlow + // NewContinueWithRecoveryUiFlow instantiates a new ContinueWithRecoveryUiFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -67,7 +74,7 @@ func (o *ContinueWithRecoveryUiFlow) SetId(v string) { // GetUrl returns the Url field value if set, zero value otherwise. func (o *ContinueWithRecoveryUiFlow) GetUrl() string { - if o == nil || o.Url == nil { + if o == nil || IsNil(o.Url) { var ret string return ret } @@ -77,7 +84,7 @@ func (o *ContinueWithRecoveryUiFlow) GetUrl() string { // GetUrlOk returns a tuple with the Url field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ContinueWithRecoveryUiFlow) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { + if o == nil || IsNil(o.Url) { return nil, false } return o.Url, true @@ -85,7 +92,7 @@ func (o *ContinueWithRecoveryUiFlow) GetUrlOk() (*string, bool) { // HasUrl returns a boolean if a field has been set. func (o *ContinueWithRecoveryUiFlow) HasUrl() bool { - if o != nil && o.Url != nil { + if o != nil && !IsNil(o.Url) { return true } @@ -98,14 +105,57 @@ func (o *ContinueWithRecoveryUiFlow) SetUrl(v string) { } func (o ContinueWithRecoveryUiFlow) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["id"] = o.Id + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Url != nil { + return json.Marshal(toSerialize) +} + +func (o ContinueWithRecoveryUiFlow) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + if !IsNil(o.Url) { toSerialize["url"] = o.Url } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *ContinueWithRecoveryUiFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithRecoveryUiFlow := _ContinueWithRecoveryUiFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithRecoveryUiFlow) + + if err != nil { + return err + } + + *o = ContinueWithRecoveryUiFlow(varContinueWithRecoveryUiFlow) + + return err } type NullableContinueWithRecoveryUiFlow struct { diff --git a/internal/client-go/model_continue_with_set_ory_session_token.go b/internal/client-go/model_continue_with_set_ory_session_token.go index 152e1455a98d..2bcddc8b9443 100644 --- a/internal/client-go/model_continue_with_set_ory_session_token.go +++ b/internal/client-go/model_continue_with_set_ory_session_token.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithSetOrySessionToken type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithSetOrySessionToken{} + // ContinueWithSetOrySessionToken Indicates that a session was issued, and the application should use this token for authenticated requests type ContinueWithSetOrySessionToken struct { // Action will always be `set_ory_session_token` set_ory_session_token ContinueWithActionSetOrySessionTokenString show_verification_ui ContinueWithActionShowVerificationUIString show_settings_ui ContinueWithActionShowSettingsUIString show_recovery_ui ContinueWithActionShowRecoveryUIString @@ -23,6 +28,8 @@ type ContinueWithSetOrySessionToken struct { OrySessionToken *string `json:"ory_session_token,omitempty"` } +type _ContinueWithSetOrySessionToken ContinueWithSetOrySessionToken + // NewContinueWithSetOrySessionToken instantiates a new ContinueWithSetOrySessionToken object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -67,7 +74,7 @@ func (o *ContinueWithSetOrySessionToken) SetAction(v string) { // GetOrySessionToken returns the OrySessionToken field value if set, zero value otherwise. func (o *ContinueWithSetOrySessionToken) GetOrySessionToken() string { - if o == nil || o.OrySessionToken == nil { + if o == nil || IsNil(o.OrySessionToken) { var ret string return ret } @@ -77,7 +84,7 @@ func (o *ContinueWithSetOrySessionToken) GetOrySessionToken() string { // GetOrySessionTokenOk returns a tuple with the OrySessionToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ContinueWithSetOrySessionToken) GetOrySessionTokenOk() (*string, bool) { - if o == nil || o.OrySessionToken == nil { + if o == nil || IsNil(o.OrySessionToken) { return nil, false } return o.OrySessionToken, true @@ -85,7 +92,7 @@ func (o *ContinueWithSetOrySessionToken) GetOrySessionTokenOk() (*string, bool) // HasOrySessionToken returns a boolean if a field has been set. func (o *ContinueWithSetOrySessionToken) HasOrySessionToken() bool { - if o != nil && o.OrySessionToken != nil { + if o != nil && !IsNil(o.OrySessionToken) { return true } @@ -98,14 +105,57 @@ func (o *ContinueWithSetOrySessionToken) SetOrySessionToken(v string) { } func (o ContinueWithSetOrySessionToken) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["action"] = o.Action + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.OrySessionToken != nil { + return json.Marshal(toSerialize) +} + +func (o ContinueWithSetOrySessionToken) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["action"] = o.Action + if !IsNil(o.OrySessionToken) { toSerialize["ory_session_token"] = o.OrySessionToken } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *ContinueWithSetOrySessionToken) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "action", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithSetOrySessionToken := _ContinueWithSetOrySessionToken{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithSetOrySessionToken) + + if err != nil { + return err + } + + *o = ContinueWithSetOrySessionToken(varContinueWithSetOrySessionToken) + + return err } type NullableContinueWithSetOrySessionToken struct { diff --git a/internal/client-go/model_continue_with_settings_ui.go b/internal/client-go/model_continue_with_settings_ui.go index f46cc4c7f696..cd955f00df34 100644 --- a/internal/client-go/model_continue_with_settings_ui.go +++ b/internal/client-go/model_continue_with_settings_ui.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithSettingsUi type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithSettingsUi{} + // ContinueWithSettingsUi Indicates, that the UI flow could be continued by showing a settings ui type ContinueWithSettingsUi struct { // Action will always be `show_settings_ui` set_ory_session_token ContinueWithActionSetOrySessionTokenString show_verification_ui ContinueWithActionShowVerificationUIString show_settings_ui ContinueWithActionShowSettingsUIString show_recovery_ui ContinueWithActionShowRecoveryUIString @@ -22,6 +27,8 @@ type ContinueWithSettingsUi struct { Flow *ContinueWithSettingsUiFlow `json:"flow,omitempty"` } +type _ContinueWithSettingsUi ContinueWithSettingsUi + // NewContinueWithSettingsUi instantiates a new ContinueWithSettingsUi object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -66,7 +73,7 @@ func (o *ContinueWithSettingsUi) SetAction(v string) { // GetFlow returns the Flow field value if set, zero value otherwise. func (o *ContinueWithSettingsUi) GetFlow() ContinueWithSettingsUiFlow { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { var ret ContinueWithSettingsUiFlow return ret } @@ -76,7 +83,7 @@ func (o *ContinueWithSettingsUi) GetFlow() ContinueWithSettingsUiFlow { // GetFlowOk returns a tuple with the Flow field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ContinueWithSettingsUi) GetFlowOk() (*ContinueWithSettingsUiFlow, bool) { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { return nil, false } return o.Flow, true @@ -84,7 +91,7 @@ func (o *ContinueWithSettingsUi) GetFlowOk() (*ContinueWithSettingsUiFlow, bool) // HasFlow returns a boolean if a field has been set. func (o *ContinueWithSettingsUi) HasFlow() bool { - if o != nil && o.Flow != nil { + if o != nil && !IsNil(o.Flow) { return true } @@ -97,14 +104,57 @@ func (o *ContinueWithSettingsUi) SetFlow(v ContinueWithSettingsUiFlow) { } func (o ContinueWithSettingsUi) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["action"] = o.Action + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Flow != nil { + return json.Marshal(toSerialize) +} + +func (o ContinueWithSettingsUi) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["action"] = o.Action + if !IsNil(o.Flow) { toSerialize["flow"] = o.Flow } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *ContinueWithSettingsUi) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "action", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithSettingsUi := _ContinueWithSettingsUi{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithSettingsUi) + + if err != nil { + return err + } + + *o = ContinueWithSettingsUi(varContinueWithSettingsUi) + + return err } type NullableContinueWithSettingsUi struct { diff --git a/internal/client-go/model_continue_with_settings_ui_flow.go b/internal/client-go/model_continue_with_settings_ui_flow.go index 4ccaf74ef1b8..3635056158f6 100644 --- a/internal/client-go/model_continue_with_settings_ui_flow.go +++ b/internal/client-go/model_continue_with_settings_ui_flow.go @@ -1,26 +1,33 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithSettingsUiFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithSettingsUiFlow{} + // ContinueWithSettingsUiFlow struct for ContinueWithSettingsUiFlow type ContinueWithSettingsUiFlow struct { // The ID of the settings flow Id string `json:"id"` } +type _ContinueWithSettingsUiFlow ContinueWithSettingsUiFlow + // NewContinueWithSettingsUiFlow instantiates a new ContinueWithSettingsUiFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -64,13 +71,56 @@ func (o *ContinueWithSettingsUiFlow) SetId(v string) { } func (o ContinueWithSettingsUiFlow) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["id"] = o.Id + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } return json.Marshal(toSerialize) } +func (o ContinueWithSettingsUiFlow) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + return toSerialize, nil +} + +func (o *ContinueWithSettingsUiFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithSettingsUiFlow := _ContinueWithSettingsUiFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithSettingsUiFlow) + + if err != nil { + return err + } + + *o = ContinueWithSettingsUiFlow(varContinueWithSettingsUiFlow) + + return err +} + type NullableContinueWithSettingsUiFlow struct { value *ContinueWithSettingsUiFlow isSet bool diff --git a/internal/client-go/model_continue_with_verification_ui.go b/internal/client-go/model_continue_with_verification_ui.go index 8d9ccd046ade..cd9c6e4c0b37 100644 --- a/internal/client-go/model_continue_with_verification_ui.go +++ b/internal/client-go/model_continue_with_verification_ui.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithVerificationUi type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithVerificationUi{} + // ContinueWithVerificationUi Indicates, that the UI flow could be continued by showing a verification ui type ContinueWithVerificationUi struct { // Action will always be `show_verification_ui` set_ory_session_token ContinueWithActionSetOrySessionTokenString show_verification_ui ContinueWithActionShowVerificationUIString show_settings_ui ContinueWithActionShowSettingsUIString show_recovery_ui ContinueWithActionShowRecoveryUIString @@ -22,6 +27,8 @@ type ContinueWithVerificationUi struct { Flow *ContinueWithVerificationUiFlow `json:"flow,omitempty"` } +type _ContinueWithVerificationUi ContinueWithVerificationUi + // NewContinueWithVerificationUi instantiates a new ContinueWithVerificationUi object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -66,7 +73,7 @@ func (o *ContinueWithVerificationUi) SetAction(v string) { // GetFlow returns the Flow field value if set, zero value otherwise. func (o *ContinueWithVerificationUi) GetFlow() ContinueWithVerificationUiFlow { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { var ret ContinueWithVerificationUiFlow return ret } @@ -76,7 +83,7 @@ func (o *ContinueWithVerificationUi) GetFlow() ContinueWithVerificationUiFlow { // GetFlowOk returns a tuple with the Flow field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ContinueWithVerificationUi) GetFlowOk() (*ContinueWithVerificationUiFlow, bool) { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { return nil, false } return o.Flow, true @@ -84,7 +91,7 @@ func (o *ContinueWithVerificationUi) GetFlowOk() (*ContinueWithVerificationUiFlo // HasFlow returns a boolean if a field has been set. func (o *ContinueWithVerificationUi) HasFlow() bool { - if o != nil && o.Flow != nil { + if o != nil && !IsNil(o.Flow) { return true } @@ -97,14 +104,57 @@ func (o *ContinueWithVerificationUi) SetFlow(v ContinueWithVerificationUiFlow) { } func (o ContinueWithVerificationUi) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["action"] = o.Action + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Flow != nil { + return json.Marshal(toSerialize) +} + +func (o ContinueWithVerificationUi) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["action"] = o.Action + if !IsNil(o.Flow) { toSerialize["flow"] = o.Flow } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *ContinueWithVerificationUi) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "action", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithVerificationUi := _ContinueWithVerificationUi{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithVerificationUi) + + if err != nil { + return err + } + + *o = ContinueWithVerificationUi(varContinueWithVerificationUi) + + return err } type NullableContinueWithVerificationUi struct { diff --git a/internal/client-go/model_continue_with_verification_ui_flow.go b/internal/client-go/model_continue_with_verification_ui_flow.go index 8fdd4609cf93..8313bc74bb91 100644 --- a/internal/client-go/model_continue_with_verification_ui_flow.go +++ b/internal/client-go/model_continue_with_verification_ui_flow.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithVerificationUiFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithVerificationUiFlow{} + // ContinueWithVerificationUiFlow struct for ContinueWithVerificationUiFlow type ContinueWithVerificationUiFlow struct { // The ID of the verification flow @@ -25,6 +30,8 @@ type ContinueWithVerificationUiFlow struct { VerifiableAddress string `json:"verifiable_address"` } +type _ContinueWithVerificationUiFlow ContinueWithVerificationUiFlow + // NewContinueWithVerificationUiFlow instantiates a new ContinueWithVerificationUiFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -70,7 +77,7 @@ func (o *ContinueWithVerificationUiFlow) SetId(v string) { // GetUrl returns the Url field value if set, zero value otherwise. func (o *ContinueWithVerificationUiFlow) GetUrl() string { - if o == nil || o.Url == nil { + if o == nil || IsNil(o.Url) { var ret string return ret } @@ -80,7 +87,7 @@ func (o *ContinueWithVerificationUiFlow) GetUrl() string { // GetUrlOk returns a tuple with the Url field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ContinueWithVerificationUiFlow) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { + if o == nil || IsNil(o.Url) { return nil, false } return o.Url, true @@ -88,7 +95,7 @@ func (o *ContinueWithVerificationUiFlow) GetUrlOk() (*string, bool) { // HasUrl returns a boolean if a field has been set. func (o *ContinueWithVerificationUiFlow) HasUrl() bool { - if o != nil && o.Url != nil { + if o != nil && !IsNil(o.Url) { return true } @@ -125,17 +132,59 @@ func (o *ContinueWithVerificationUiFlow) SetVerifiableAddress(v string) { } func (o ContinueWithVerificationUiFlow) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["id"] = o.Id + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Url != nil { + return json.Marshal(toSerialize) +} + +func (o ContinueWithVerificationUiFlow) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + if !IsNil(o.Url) { toSerialize["url"] = o.Url } - if true { - toSerialize["verifiable_address"] = o.VerifiableAddress + toSerialize["verifiable_address"] = o.VerifiableAddress + return toSerialize, nil +} + +func (o *ContinueWithVerificationUiFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "verifiable_address", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithVerificationUiFlow := _ContinueWithVerificationUiFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithVerificationUiFlow) + + if err != nil { + return err + } + + *o = ContinueWithVerificationUiFlow(varContinueWithVerificationUiFlow) + + return err } type NullableContinueWithVerificationUiFlow struct { diff --git a/internal/client-go/model_courier_message_status.go b/internal/client-go/model_courier_message_status.go index 0ea66ef9de23..d152440a3055 100644 --- a/internal/client-go/model_courier_message_status.go +++ b/internal/client-go/model_courier_message_status.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -27,6 +27,14 @@ const ( COURIERMESSAGESTATUS_ABANDONED CourierMessageStatus = "abandoned" ) +// All allowed values of CourierMessageStatus enum +var AllowedCourierMessageStatusEnumValues = []CourierMessageStatus{ + "queued", + "sent", + "processing", + "abandoned", +} + func (v *CourierMessageStatus) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -34,7 +42,7 @@ func (v *CourierMessageStatus) UnmarshalJSON(src []byte) error { return err } enumTypeValue := CourierMessageStatus(value) - for _, existing := range []CourierMessageStatus{"queued", "sent", "processing", "abandoned"} { + for _, existing := range AllowedCourierMessageStatusEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -44,6 +52,27 @@ func (v *CourierMessageStatus) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid CourierMessageStatus", value) } +// NewCourierMessageStatusFromValue returns a pointer to a valid CourierMessageStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCourierMessageStatusFromValue(v string) (*CourierMessageStatus, error) { + ev := CourierMessageStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CourierMessageStatus: valid values are %v", v, AllowedCourierMessageStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CourierMessageStatus) IsValid() bool { + for _, existing := range AllowedCourierMessageStatusEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to courierMessageStatus value func (v CourierMessageStatus) Ptr() *CourierMessageStatus { return &v diff --git a/internal/client-go/model_courier_message_type.go b/internal/client-go/model_courier_message_type.go index 9b6811c116d5..28e0a3563741 100644 --- a/internal/client-go/model_courier_message_type.go +++ b/internal/client-go/model_courier_message_type.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -25,6 +25,12 @@ const ( COURIERMESSAGETYPE_PHONE CourierMessageType = "phone" ) +// All allowed values of CourierMessageType enum +var AllowedCourierMessageTypeEnumValues = []CourierMessageType{ + "email", + "phone", +} + func (v *CourierMessageType) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -32,7 +38,7 @@ func (v *CourierMessageType) UnmarshalJSON(src []byte) error { return err } enumTypeValue := CourierMessageType(value) - for _, existing := range []CourierMessageType{"email", "phone"} { + for _, existing := range AllowedCourierMessageTypeEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -42,6 +48,27 @@ func (v *CourierMessageType) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid CourierMessageType", value) } +// NewCourierMessageTypeFromValue returns a pointer to a valid CourierMessageType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCourierMessageTypeFromValue(v string) (*CourierMessageType, error) { + ev := CourierMessageType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CourierMessageType: valid values are %v", v, AllowedCourierMessageTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CourierMessageType) IsValid() bool { + for _, existing := range AllowedCourierMessageTypeEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to courierMessageType value func (v CourierMessageType) Ptr() *CourierMessageType { return &v diff --git a/internal/client-go/model_create_identity_body.go b/internal/client-go/model_create_identity_body.go index 177317c62d2e..b4fc33e27f9d 100644 --- a/internal/client-go/model_create_identity_body.go +++ b/internal/client-go/model_create_identity_body.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the CreateIdentityBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateIdentityBody{} + // CreateIdentityBody Create Identity Body type CreateIdentityBody struct { Credentials *IdentityWithCredentials `json:"credentials,omitempty"` @@ -34,6 +39,8 @@ type CreateIdentityBody struct { VerifiableAddresses []VerifiableIdentityAddress `json:"verifiable_addresses,omitempty"` } +type _CreateIdentityBody CreateIdentityBody + // NewCreateIdentityBody instantiates a new CreateIdentityBody object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -55,7 +62,7 @@ func NewCreateIdentityBodyWithDefaults() *CreateIdentityBody { // GetCredentials returns the Credentials field value if set, zero value otherwise. func (o *CreateIdentityBody) GetCredentials() IdentityWithCredentials { - if o == nil || o.Credentials == nil { + if o == nil || IsNil(o.Credentials) { var ret IdentityWithCredentials return ret } @@ -65,7 +72,7 @@ func (o *CreateIdentityBody) GetCredentials() IdentityWithCredentials { // GetCredentialsOk returns a tuple with the Credentials field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateIdentityBody) GetCredentialsOk() (*IdentityWithCredentials, bool) { - if o == nil || o.Credentials == nil { + if o == nil || IsNil(o.Credentials) { return nil, false } return o.Credentials, true @@ -73,7 +80,7 @@ func (o *CreateIdentityBody) GetCredentialsOk() (*IdentityWithCredentials, bool) // HasCredentials returns a boolean if a field has been set. func (o *CreateIdentityBody) HasCredentials() bool { - if o != nil && o.Credentials != nil { + if o != nil && !IsNil(o.Credentials) { return true } @@ -98,7 +105,7 @@ func (o *CreateIdentityBody) GetMetadataAdmin() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *CreateIdentityBody) GetMetadataAdminOk() (*interface{}, bool) { - if o == nil || o.MetadataAdmin == nil { + if o == nil || IsNil(o.MetadataAdmin) { return nil, false } return &o.MetadataAdmin, true @@ -106,7 +113,7 @@ func (o *CreateIdentityBody) GetMetadataAdminOk() (*interface{}, bool) { // HasMetadataAdmin returns a boolean if a field has been set. func (o *CreateIdentityBody) HasMetadataAdmin() bool { - if o != nil && o.MetadataAdmin != nil { + if o != nil && IsNil(o.MetadataAdmin) { return true } @@ -131,7 +138,7 @@ func (o *CreateIdentityBody) GetMetadataPublic() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *CreateIdentityBody) GetMetadataPublicOk() (*interface{}, bool) { - if o == nil || o.MetadataPublic == nil { + if o == nil || IsNil(o.MetadataPublic) { return nil, false } return &o.MetadataPublic, true @@ -139,7 +146,7 @@ func (o *CreateIdentityBody) GetMetadataPublicOk() (*interface{}, bool) { // HasMetadataPublic returns a boolean if a field has been set. func (o *CreateIdentityBody) HasMetadataPublic() bool { - if o != nil && o.MetadataPublic != nil { + if o != nil && IsNil(o.MetadataPublic) { return true } @@ -153,7 +160,7 @@ func (o *CreateIdentityBody) SetMetadataPublic(v interface{}) { // GetRecoveryAddresses returns the RecoveryAddresses field value if set, zero value otherwise. func (o *CreateIdentityBody) GetRecoveryAddresses() []RecoveryIdentityAddress { - if o == nil || o.RecoveryAddresses == nil { + if o == nil || IsNil(o.RecoveryAddresses) { var ret []RecoveryIdentityAddress return ret } @@ -163,7 +170,7 @@ func (o *CreateIdentityBody) GetRecoveryAddresses() []RecoveryIdentityAddress { // GetRecoveryAddressesOk returns a tuple with the RecoveryAddresses field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateIdentityBody) GetRecoveryAddressesOk() ([]RecoveryIdentityAddress, bool) { - if o == nil || o.RecoveryAddresses == nil { + if o == nil || IsNil(o.RecoveryAddresses) { return nil, false } return o.RecoveryAddresses, true @@ -171,7 +178,7 @@ func (o *CreateIdentityBody) GetRecoveryAddressesOk() ([]RecoveryIdentityAddress // HasRecoveryAddresses returns a boolean if a field has been set. func (o *CreateIdentityBody) HasRecoveryAddresses() bool { - if o != nil && o.RecoveryAddresses != nil { + if o != nil && !IsNil(o.RecoveryAddresses) { return true } @@ -209,7 +216,7 @@ func (o *CreateIdentityBody) SetSchemaId(v string) { // GetState returns the State field value if set, zero value otherwise. func (o *CreateIdentityBody) GetState() string { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { var ret string return ret } @@ -219,7 +226,7 @@ func (o *CreateIdentityBody) GetState() string { // GetStateOk returns a tuple with the State field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateIdentityBody) GetStateOk() (*string, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return o.State, true @@ -227,7 +234,7 @@ func (o *CreateIdentityBody) GetStateOk() (*string, bool) { // HasState returns a boolean if a field has been set. func (o *CreateIdentityBody) HasState() bool { - if o != nil && o.State != nil { + if o != nil && !IsNil(o.State) { return true } @@ -253,7 +260,7 @@ func (o *CreateIdentityBody) GetTraits() map[string]interface{} { // and a boolean to check if the value has been set. func (o *CreateIdentityBody) GetTraitsOk() (map[string]interface{}, bool) { if o == nil { - return nil, false + return map[string]interface{}{}, false } return o.Traits, true } @@ -265,7 +272,7 @@ func (o *CreateIdentityBody) SetTraits(v map[string]interface{}) { // GetVerifiableAddresses returns the VerifiableAddresses field value if set, zero value otherwise. func (o *CreateIdentityBody) GetVerifiableAddresses() []VerifiableIdentityAddress { - if o == nil || o.VerifiableAddresses == nil { + if o == nil || IsNil(o.VerifiableAddresses) { var ret []VerifiableIdentityAddress return ret } @@ -275,7 +282,7 @@ func (o *CreateIdentityBody) GetVerifiableAddresses() []VerifiableIdentityAddres // GetVerifiableAddressesOk returns a tuple with the VerifiableAddresses field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateIdentityBody) GetVerifiableAddressesOk() ([]VerifiableIdentityAddress, bool) { - if o == nil || o.VerifiableAddresses == nil { + if o == nil || IsNil(o.VerifiableAddresses) { return nil, false } return o.VerifiableAddresses, true @@ -283,7 +290,7 @@ func (o *CreateIdentityBody) GetVerifiableAddressesOk() ([]VerifiableIdentityAdd // HasVerifiableAddresses returns a boolean if a field has been set. func (o *CreateIdentityBody) HasVerifiableAddresses() bool { - if o != nil && o.VerifiableAddresses != nil { + if o != nil && !IsNil(o.VerifiableAddresses) { return true } @@ -296,8 +303,16 @@ func (o *CreateIdentityBody) SetVerifiableAddresses(v []VerifiableIdentityAddres } func (o CreateIdentityBody) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateIdentityBody) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Credentials != nil { + if !IsNil(o.Credentials) { toSerialize["credentials"] = o.Credentials } if o.MetadataAdmin != nil { @@ -306,22 +321,56 @@ func (o CreateIdentityBody) MarshalJSON() ([]byte, error) { if o.MetadataPublic != nil { toSerialize["metadata_public"] = o.MetadataPublic } - if o.RecoveryAddresses != nil { + if !IsNil(o.RecoveryAddresses) { toSerialize["recovery_addresses"] = o.RecoveryAddresses } - if true { - toSerialize["schema_id"] = o.SchemaId - } - if o.State != nil { + toSerialize["schema_id"] = o.SchemaId + if !IsNil(o.State) { toSerialize["state"] = o.State } - if true { - toSerialize["traits"] = o.Traits - } - if o.VerifiableAddresses != nil { + toSerialize["traits"] = o.Traits + if !IsNil(o.VerifiableAddresses) { toSerialize["verifiable_addresses"] = o.VerifiableAddresses } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *CreateIdentityBody) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "schema_id", + "traits", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateIdentityBody := _CreateIdentityBody{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateIdentityBody) + + if err != nil { + return err + } + + *o = CreateIdentityBody(varCreateIdentityBody) + + return err } type NullableCreateIdentityBody struct { diff --git a/internal/client-go/model_create_recovery_code_for_identity_body.go b/internal/client-go/model_create_recovery_code_for_identity_body.go index 850c7e086206..f37e66518b77 100644 --- a/internal/client-go/model_create_recovery_code_for_identity_body.go +++ b/internal/client-go/model_create_recovery_code_for_identity_body.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the CreateRecoveryCodeForIdentityBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateRecoveryCodeForIdentityBody{} + // CreateRecoveryCodeForIdentityBody Create Recovery Code for Identity Request Body type CreateRecoveryCodeForIdentityBody struct { // Code Expires In The recovery code will expire after that amount of time has passed. Defaults to the configuration value of `selfservice.methods.code.config.lifespan`. @@ -23,6 +28,8 @@ type CreateRecoveryCodeForIdentityBody struct { IdentityId string `json:"identity_id"` } +type _CreateRecoveryCodeForIdentityBody CreateRecoveryCodeForIdentityBody + // NewCreateRecoveryCodeForIdentityBody instantiates a new CreateRecoveryCodeForIdentityBody object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -43,7 +50,7 @@ func NewCreateRecoveryCodeForIdentityBodyWithDefaults() *CreateRecoveryCodeForId // GetExpiresIn returns the ExpiresIn field value if set, zero value otherwise. func (o *CreateRecoveryCodeForIdentityBody) GetExpiresIn() string { - if o == nil || o.ExpiresIn == nil { + if o == nil || IsNil(o.ExpiresIn) { var ret string return ret } @@ -53,7 +60,7 @@ func (o *CreateRecoveryCodeForIdentityBody) GetExpiresIn() string { // GetExpiresInOk returns a tuple with the ExpiresIn field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateRecoveryCodeForIdentityBody) GetExpiresInOk() (*string, bool) { - if o == nil || o.ExpiresIn == nil { + if o == nil || IsNil(o.ExpiresIn) { return nil, false } return o.ExpiresIn, true @@ -61,7 +68,7 @@ func (o *CreateRecoveryCodeForIdentityBody) GetExpiresInOk() (*string, bool) { // HasExpiresIn returns a boolean if a field has been set. func (o *CreateRecoveryCodeForIdentityBody) HasExpiresIn() bool { - if o != nil && o.ExpiresIn != nil { + if o != nil && !IsNil(o.ExpiresIn) { return true } @@ -98,14 +105,57 @@ func (o *CreateRecoveryCodeForIdentityBody) SetIdentityId(v string) { } func (o CreateRecoveryCodeForIdentityBody) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateRecoveryCodeForIdentityBody) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.ExpiresIn != nil { + if !IsNil(o.ExpiresIn) { toSerialize["expires_in"] = o.ExpiresIn } - if true { - toSerialize["identity_id"] = o.IdentityId + toSerialize["identity_id"] = o.IdentityId + return toSerialize, nil +} + +func (o *CreateRecoveryCodeForIdentityBody) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "identity_id", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateRecoveryCodeForIdentityBody := _CreateRecoveryCodeForIdentityBody{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateRecoveryCodeForIdentityBody) + + if err != nil { + return err + } + + *o = CreateRecoveryCodeForIdentityBody(varCreateRecoveryCodeForIdentityBody) + + return err } type NullableCreateRecoveryCodeForIdentityBody struct { diff --git a/internal/client-go/model_create_recovery_link_for_identity_body.go b/internal/client-go/model_create_recovery_link_for_identity_body.go index 2db109d221bf..2fc45f7cf866 100644 --- a/internal/client-go/model_create_recovery_link_for_identity_body.go +++ b/internal/client-go/model_create_recovery_link_for_identity_body.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the CreateRecoveryLinkForIdentityBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateRecoveryLinkForIdentityBody{} + // CreateRecoveryLinkForIdentityBody Create Recovery Link for Identity Request Body type CreateRecoveryLinkForIdentityBody struct { // Link Expires In The recovery link will expire after that amount of time has passed. Defaults to the configuration value of `selfservice.methods.code.config.lifespan`. @@ -23,6 +28,8 @@ type CreateRecoveryLinkForIdentityBody struct { IdentityId string `json:"identity_id"` } +type _CreateRecoveryLinkForIdentityBody CreateRecoveryLinkForIdentityBody + // NewCreateRecoveryLinkForIdentityBody instantiates a new CreateRecoveryLinkForIdentityBody object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -43,7 +50,7 @@ func NewCreateRecoveryLinkForIdentityBodyWithDefaults() *CreateRecoveryLinkForId // GetExpiresIn returns the ExpiresIn field value if set, zero value otherwise. func (o *CreateRecoveryLinkForIdentityBody) GetExpiresIn() string { - if o == nil || o.ExpiresIn == nil { + if o == nil || IsNil(o.ExpiresIn) { var ret string return ret } @@ -53,7 +60,7 @@ func (o *CreateRecoveryLinkForIdentityBody) GetExpiresIn() string { // GetExpiresInOk returns a tuple with the ExpiresIn field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateRecoveryLinkForIdentityBody) GetExpiresInOk() (*string, bool) { - if o == nil || o.ExpiresIn == nil { + if o == nil || IsNil(o.ExpiresIn) { return nil, false } return o.ExpiresIn, true @@ -61,7 +68,7 @@ func (o *CreateRecoveryLinkForIdentityBody) GetExpiresInOk() (*string, bool) { // HasExpiresIn returns a boolean if a field has been set. func (o *CreateRecoveryLinkForIdentityBody) HasExpiresIn() bool { - if o != nil && o.ExpiresIn != nil { + if o != nil && !IsNil(o.ExpiresIn) { return true } @@ -98,14 +105,57 @@ func (o *CreateRecoveryLinkForIdentityBody) SetIdentityId(v string) { } func (o CreateRecoveryLinkForIdentityBody) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateRecoveryLinkForIdentityBody) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.ExpiresIn != nil { + if !IsNil(o.ExpiresIn) { toSerialize["expires_in"] = o.ExpiresIn } - if true { - toSerialize["identity_id"] = o.IdentityId + toSerialize["identity_id"] = o.IdentityId + return toSerialize, nil +} + +func (o *CreateRecoveryLinkForIdentityBody) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "identity_id", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateRecoveryLinkForIdentityBody := _CreateRecoveryLinkForIdentityBody{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateRecoveryLinkForIdentityBody) + + if err != nil { + return err + } + + *o = CreateRecoveryLinkForIdentityBody(varCreateRecoveryLinkForIdentityBody) + + return err } type NullableCreateRecoveryLinkForIdentityBody struct { diff --git a/internal/client-go/model_delete_my_sessions_count.go b/internal/client-go/model_delete_my_sessions_count.go index 253834fbff63..4443633be66c 100644 --- a/internal/client-go/model_delete_my_sessions_count.go +++ b/internal/client-go/model_delete_my_sessions_count.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the DeleteMySessionsCount type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeleteMySessionsCount{} + // DeleteMySessionsCount Deleted Session Count type DeleteMySessionsCount struct { // The number of sessions that were revoked. @@ -40,7 +43,7 @@ func NewDeleteMySessionsCountWithDefaults() *DeleteMySessionsCount { // GetCount returns the Count field value if set, zero value otherwise. func (o *DeleteMySessionsCount) GetCount() int64 { - if o == nil || o.Count == nil { + if o == nil || IsNil(o.Count) { var ret int64 return ret } @@ -50,7 +53,7 @@ func (o *DeleteMySessionsCount) GetCount() int64 { // GetCountOk returns a tuple with the Count field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeleteMySessionsCount) GetCountOk() (*int64, bool) { - if o == nil || o.Count == nil { + if o == nil || IsNil(o.Count) { return nil, false } return o.Count, true @@ -58,7 +61,7 @@ func (o *DeleteMySessionsCount) GetCountOk() (*int64, bool) { // HasCount returns a boolean if a field has been set. func (o *DeleteMySessionsCount) HasCount() bool { - if o != nil && o.Count != nil { + if o != nil && !IsNil(o.Count) { return true } @@ -71,11 +74,19 @@ func (o *DeleteMySessionsCount) SetCount(v int64) { } func (o DeleteMySessionsCount) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeleteMySessionsCount) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Count != nil { + if !IsNil(o.Count) { toSerialize["count"] = o.Count } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableDeleteMySessionsCount struct { diff --git a/internal/client-go/model_error_authenticator_assurance_level_not_satisfied.go b/internal/client-go/model_error_authenticator_assurance_level_not_satisfied.go index b7b29bea8b3a..500a71d09d23 100644 --- a/internal/client-go/model_error_authenticator_assurance_level_not_satisfied.go +++ b/internal/client-go/model_error_authenticator_assurance_level_not_satisfied.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the ErrorAuthenticatorAssuranceLevelNotSatisfied type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorAuthenticatorAssuranceLevelNotSatisfied{} + // ErrorAuthenticatorAssuranceLevelNotSatisfied struct for ErrorAuthenticatorAssuranceLevelNotSatisfied type ErrorAuthenticatorAssuranceLevelNotSatisfied struct { Error *GenericError `json:"error,omitempty"` @@ -41,7 +44,7 @@ func NewErrorAuthenticatorAssuranceLevelNotSatisfiedWithDefaults() *ErrorAuthent // GetError returns the Error field value if set, zero value otherwise. func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetError() GenericError { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret GenericError return ret } @@ -51,7 +54,7 @@ func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetError() GenericError { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetErrorOk() (*GenericError, bool) { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { return nil, false } return o.Error, true @@ -59,7 +62,7 @@ func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetErrorOk() (*GenericErr // HasError returns a boolean if a field has been set. func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -73,7 +76,7 @@ func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) SetError(v GenericError) // GetRedirectBrowserTo returns the RedirectBrowserTo field value if set, zero value otherwise. func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetRedirectBrowserTo() string { - if o == nil || o.RedirectBrowserTo == nil { + if o == nil || IsNil(o.RedirectBrowserTo) { var ret string return ret } @@ -83,7 +86,7 @@ func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetRedirectBrowserTo() st // GetRedirectBrowserToOk returns a tuple with the RedirectBrowserTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetRedirectBrowserToOk() (*string, bool) { - if o == nil || o.RedirectBrowserTo == nil { + if o == nil || IsNil(o.RedirectBrowserTo) { return nil, false } return o.RedirectBrowserTo, true @@ -91,7 +94,7 @@ func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetRedirectBrowserToOk() // HasRedirectBrowserTo returns a boolean if a field has been set. func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) HasRedirectBrowserTo() bool { - if o != nil && o.RedirectBrowserTo != nil { + if o != nil && !IsNil(o.RedirectBrowserTo) { return true } @@ -104,14 +107,22 @@ func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) SetRedirectBrowserTo(v st } func (o ErrorAuthenticatorAssuranceLevelNotSatisfied) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorAuthenticatorAssuranceLevelNotSatisfied) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Error != nil { + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if o.RedirectBrowserTo != nil { + if !IsNil(o.RedirectBrowserTo) { toSerialize["redirect_browser_to"] = o.RedirectBrowserTo } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableErrorAuthenticatorAssuranceLevelNotSatisfied struct { diff --git a/internal/client-go/model_error_browser_location_change_required.go b/internal/client-go/model_error_browser_location_change_required.go index 4fdf23795557..b4d75871b59a 100644 --- a/internal/client-go/model_error_browser_location_change_required.go +++ b/internal/client-go/model_error_browser_location_change_required.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the ErrorBrowserLocationChangeRequired type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorBrowserLocationChangeRequired{} + // ErrorBrowserLocationChangeRequired struct for ErrorBrowserLocationChangeRequired type ErrorBrowserLocationChangeRequired struct { Error *ErrorGeneric `json:"error,omitempty"` @@ -41,7 +44,7 @@ func NewErrorBrowserLocationChangeRequiredWithDefaults() *ErrorBrowserLocationCh // GetError returns the Error field value if set, zero value otherwise. func (o *ErrorBrowserLocationChangeRequired) GetError() ErrorGeneric { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret ErrorGeneric return ret } @@ -51,7 +54,7 @@ func (o *ErrorBrowserLocationChangeRequired) GetError() ErrorGeneric { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorBrowserLocationChangeRequired) GetErrorOk() (*ErrorGeneric, bool) { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { return nil, false } return o.Error, true @@ -59,7 +62,7 @@ func (o *ErrorBrowserLocationChangeRequired) GetErrorOk() (*ErrorGeneric, bool) // HasError returns a boolean if a field has been set. func (o *ErrorBrowserLocationChangeRequired) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -73,7 +76,7 @@ func (o *ErrorBrowserLocationChangeRequired) SetError(v ErrorGeneric) { // GetRedirectBrowserTo returns the RedirectBrowserTo field value if set, zero value otherwise. func (o *ErrorBrowserLocationChangeRequired) GetRedirectBrowserTo() string { - if o == nil || o.RedirectBrowserTo == nil { + if o == nil || IsNil(o.RedirectBrowserTo) { var ret string return ret } @@ -83,7 +86,7 @@ func (o *ErrorBrowserLocationChangeRequired) GetRedirectBrowserTo() string { // GetRedirectBrowserToOk returns a tuple with the RedirectBrowserTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorBrowserLocationChangeRequired) GetRedirectBrowserToOk() (*string, bool) { - if o == nil || o.RedirectBrowserTo == nil { + if o == nil || IsNil(o.RedirectBrowserTo) { return nil, false } return o.RedirectBrowserTo, true @@ -91,7 +94,7 @@ func (o *ErrorBrowserLocationChangeRequired) GetRedirectBrowserToOk() (*string, // HasRedirectBrowserTo returns a boolean if a field has been set. func (o *ErrorBrowserLocationChangeRequired) HasRedirectBrowserTo() bool { - if o != nil && o.RedirectBrowserTo != nil { + if o != nil && !IsNil(o.RedirectBrowserTo) { return true } @@ -104,14 +107,22 @@ func (o *ErrorBrowserLocationChangeRequired) SetRedirectBrowserTo(v string) { } func (o ErrorBrowserLocationChangeRequired) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorBrowserLocationChangeRequired) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Error != nil { + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if o.RedirectBrowserTo != nil { + if !IsNil(o.RedirectBrowserTo) { toSerialize["redirect_browser_to"] = o.RedirectBrowserTo } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableErrorBrowserLocationChangeRequired struct { diff --git a/internal/client-go/model_error_flow_replaced.go b/internal/client-go/model_error_flow_replaced.go index 856423abc1ad..2c763983d7c7 100644 --- a/internal/client-go/model_error_flow_replaced.go +++ b/internal/client-go/model_error_flow_replaced.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the ErrorFlowReplaced type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorFlowReplaced{} + // ErrorFlowReplaced Is sent when a flow is replaced by a different flow of the same class type ErrorFlowReplaced struct { Error *GenericError `json:"error,omitempty"` @@ -41,7 +44,7 @@ func NewErrorFlowReplacedWithDefaults() *ErrorFlowReplaced { // GetError returns the Error field value if set, zero value otherwise. func (o *ErrorFlowReplaced) GetError() GenericError { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret GenericError return ret } @@ -51,7 +54,7 @@ func (o *ErrorFlowReplaced) GetError() GenericError { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorFlowReplaced) GetErrorOk() (*GenericError, bool) { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { return nil, false } return o.Error, true @@ -59,7 +62,7 @@ func (o *ErrorFlowReplaced) GetErrorOk() (*GenericError, bool) { // HasError returns a boolean if a field has been set. func (o *ErrorFlowReplaced) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -73,7 +76,7 @@ func (o *ErrorFlowReplaced) SetError(v GenericError) { // GetUseFlowId returns the UseFlowId field value if set, zero value otherwise. func (o *ErrorFlowReplaced) GetUseFlowId() string { - if o == nil || o.UseFlowId == nil { + if o == nil || IsNil(o.UseFlowId) { var ret string return ret } @@ -83,7 +86,7 @@ func (o *ErrorFlowReplaced) GetUseFlowId() string { // GetUseFlowIdOk returns a tuple with the UseFlowId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorFlowReplaced) GetUseFlowIdOk() (*string, bool) { - if o == nil || o.UseFlowId == nil { + if o == nil || IsNil(o.UseFlowId) { return nil, false } return o.UseFlowId, true @@ -91,7 +94,7 @@ func (o *ErrorFlowReplaced) GetUseFlowIdOk() (*string, bool) { // HasUseFlowId returns a boolean if a field has been set. func (o *ErrorFlowReplaced) HasUseFlowId() bool { - if o != nil && o.UseFlowId != nil { + if o != nil && !IsNil(o.UseFlowId) { return true } @@ -104,14 +107,22 @@ func (o *ErrorFlowReplaced) SetUseFlowId(v string) { } func (o ErrorFlowReplaced) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorFlowReplaced) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Error != nil { + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if o.UseFlowId != nil { + if !IsNil(o.UseFlowId) { toSerialize["use_flow_id"] = o.UseFlowId } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableErrorFlowReplaced struct { diff --git a/internal/client-go/model_error_generic.go b/internal/client-go/model_error_generic.go index f58c90015a42..2e50f7675812 100644 --- a/internal/client-go/model_error_generic.go +++ b/internal/client-go/model_error_generic.go @@ -1,25 +1,32 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ErrorGeneric type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorGeneric{} + // ErrorGeneric The standard Ory JSON API error format. type ErrorGeneric struct { Error GenericError `json:"error"` } +type _ErrorGeneric ErrorGeneric + // NewErrorGeneric instantiates a new ErrorGeneric object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -63,13 +70,56 @@ func (o *ErrorGeneric) SetError(v GenericError) { } func (o ErrorGeneric) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["error"] = o.Error + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } return json.Marshal(toSerialize) } +func (o ErrorGeneric) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["error"] = o.Error + return toSerialize, nil +} + +func (o *ErrorGeneric) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "error", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varErrorGeneric := _ErrorGeneric{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varErrorGeneric) + + if err != nil { + return err + } + + *o = ErrorGeneric(varErrorGeneric) + + return err +} + type NullableErrorGeneric struct { value *ErrorGeneric isSet bool diff --git a/internal/client-go/model_flow_error.go b/internal/client-go/model_flow_error.go index e0e8e7ab37c5..22795dbc9c2e 100644 --- a/internal/client-go/model_flow_error.go +++ b/internal/client-go/model_flow_error.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the FlowError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FlowError{} + // FlowError struct for FlowError type FlowError struct { // CreatedAt is a helper struct field for gobuffalo.pop. @@ -27,6 +32,8 @@ type FlowError struct { UpdatedAt *time.Time `json:"updated_at,omitempty"` } +type _FlowError FlowError + // NewFlowError instantiates a new FlowError object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -47,7 +54,7 @@ func NewFlowErrorWithDefaults() *FlowError { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *FlowError) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -57,7 +64,7 @@ func (o *FlowError) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *FlowError) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -65,7 +72,7 @@ func (o *FlowError) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *FlowError) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -79,7 +86,7 @@ func (o *FlowError) SetCreatedAt(v time.Time) { // GetError returns the Error field value if set, zero value otherwise. func (o *FlowError) GetError() map[string]interface{} { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret map[string]interface{} return ret } @@ -89,15 +96,15 @@ func (o *FlowError) GetError() map[string]interface{} { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *FlowError) GetErrorOk() (map[string]interface{}, bool) { - if o == nil || o.Error == nil { - return nil, false + if o == nil || IsNil(o.Error) { + return map[string]interface{}{}, false } return o.Error, true } // HasError returns a boolean if a field has been set. func (o *FlowError) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -135,7 +142,7 @@ func (o *FlowError) SetId(v string) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *FlowError) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -145,7 +152,7 @@ func (o *FlowError) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *FlowError) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -153,7 +160,7 @@ func (o *FlowError) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *FlowError) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -166,20 +173,63 @@ func (o *FlowError) SetUpdatedAt(v time.Time) { } func (o FlowError) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FlowError) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if o.Error != nil { + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if true { - toSerialize["id"] = o.Id - } - if o.UpdatedAt != nil { + toSerialize["id"] = o.Id + if !IsNil(o.UpdatedAt) { toSerialize["updated_at"] = o.UpdatedAt } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *FlowError) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varFlowError := _FlowError{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varFlowError) + + if err != nil { + return err + } + + *o = FlowError(varFlowError) + + return err } type NullableFlowError struct { diff --git a/internal/client-go/model_generic_error.go b/internal/client-go/model_generic_error.go index fb93065ad37a..46c2f4c2ddd3 100644 --- a/internal/client-go/model_generic_error.go +++ b/internal/client-go/model_generic_error.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the GenericError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GenericError{} + // GenericError struct for GenericError type GenericError struct { // The status code @@ -35,6 +40,8 @@ type GenericError struct { Status *string `json:"status,omitempty"` } +type _GenericError GenericError + // NewGenericError instantiates a new GenericError object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -55,7 +62,7 @@ func NewGenericErrorWithDefaults() *GenericError { // GetCode returns the Code field value if set, zero value otherwise. func (o *GenericError) GetCode() int64 { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { var ret int64 return ret } @@ -65,7 +72,7 @@ func (o *GenericError) GetCode() int64 { // GetCodeOk returns a tuple with the Code field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetCodeOk() (*int64, bool) { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { return nil, false } return o.Code, true @@ -73,7 +80,7 @@ func (o *GenericError) GetCodeOk() (*int64, bool) { // HasCode returns a boolean if a field has been set. func (o *GenericError) HasCode() bool { - if o != nil && o.Code != nil { + if o != nil && !IsNil(o.Code) { return true } @@ -87,7 +94,7 @@ func (o *GenericError) SetCode(v int64) { // GetDebug returns the Debug field value if set, zero value otherwise. func (o *GenericError) GetDebug() string { - if o == nil || o.Debug == nil { + if o == nil || IsNil(o.Debug) { var ret string return ret } @@ -97,7 +104,7 @@ func (o *GenericError) GetDebug() string { // GetDebugOk returns a tuple with the Debug field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetDebugOk() (*string, bool) { - if o == nil || o.Debug == nil { + if o == nil || IsNil(o.Debug) { return nil, false } return o.Debug, true @@ -105,7 +112,7 @@ func (o *GenericError) GetDebugOk() (*string, bool) { // HasDebug returns a boolean if a field has been set. func (o *GenericError) HasDebug() bool { - if o != nil && o.Debug != nil { + if o != nil && !IsNil(o.Debug) { return true } @@ -119,7 +126,7 @@ func (o *GenericError) SetDebug(v string) { // GetDetails returns the Details field value if set, zero value otherwise. func (o *GenericError) GetDetails() map[string]interface{} { - if o == nil || o.Details == nil { + if o == nil || IsNil(o.Details) { var ret map[string]interface{} return ret } @@ -129,15 +136,15 @@ func (o *GenericError) GetDetails() map[string]interface{} { // GetDetailsOk returns a tuple with the Details field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetDetailsOk() (map[string]interface{}, bool) { - if o == nil || o.Details == nil { - return nil, false + if o == nil || IsNil(o.Details) { + return map[string]interface{}{}, false } return o.Details, true } // HasDetails returns a boolean if a field has been set. func (o *GenericError) HasDetails() bool { - if o != nil && o.Details != nil { + if o != nil && !IsNil(o.Details) { return true } @@ -151,7 +158,7 @@ func (o *GenericError) SetDetails(v map[string]interface{}) { // GetId returns the Id field value if set, zero value otherwise. func (o *GenericError) GetId() string { - if o == nil || o.Id == nil { + if o == nil || IsNil(o.Id) { var ret string return ret } @@ -161,7 +168,7 @@ func (o *GenericError) GetId() string { // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { + if o == nil || IsNil(o.Id) { return nil, false } return o.Id, true @@ -169,7 +176,7 @@ func (o *GenericError) GetIdOk() (*string, bool) { // HasId returns a boolean if a field has been set. func (o *GenericError) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } @@ -207,7 +214,7 @@ func (o *GenericError) SetMessage(v string) { // GetReason returns the Reason field value if set, zero value otherwise. func (o *GenericError) GetReason() string { - if o == nil || o.Reason == nil { + if o == nil || IsNil(o.Reason) { var ret string return ret } @@ -217,7 +224,7 @@ func (o *GenericError) GetReason() string { // GetReasonOk returns a tuple with the Reason field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetReasonOk() (*string, bool) { - if o == nil || o.Reason == nil { + if o == nil || IsNil(o.Reason) { return nil, false } return o.Reason, true @@ -225,7 +232,7 @@ func (o *GenericError) GetReasonOk() (*string, bool) { // HasReason returns a boolean if a field has been set. func (o *GenericError) HasReason() bool { - if o != nil && o.Reason != nil { + if o != nil && !IsNil(o.Reason) { return true } @@ -239,7 +246,7 @@ func (o *GenericError) SetReason(v string) { // GetRequest returns the Request field value if set, zero value otherwise. func (o *GenericError) GetRequest() string { - if o == nil || o.Request == nil { + if o == nil || IsNil(o.Request) { var ret string return ret } @@ -249,7 +256,7 @@ func (o *GenericError) GetRequest() string { // GetRequestOk returns a tuple with the Request field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetRequestOk() (*string, bool) { - if o == nil || o.Request == nil { + if o == nil || IsNil(o.Request) { return nil, false } return o.Request, true @@ -257,7 +264,7 @@ func (o *GenericError) GetRequestOk() (*string, bool) { // HasRequest returns a boolean if a field has been set. func (o *GenericError) HasRequest() bool { - if o != nil && o.Request != nil { + if o != nil && !IsNil(o.Request) { return true } @@ -271,7 +278,7 @@ func (o *GenericError) SetRequest(v string) { // GetStatus returns the Status field value if set, zero value otherwise. func (o *GenericError) GetStatus() string { - if o == nil || o.Status == nil { + if o == nil || IsNil(o.Status) { var ret string return ret } @@ -281,7 +288,7 @@ func (o *GenericError) GetStatus() string { // GetStatusOk returns a tuple with the Status field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { + if o == nil || IsNil(o.Status) { return nil, false } return o.Status, true @@ -289,7 +296,7 @@ func (o *GenericError) GetStatusOk() (*string, bool) { // HasStatus returns a boolean if a field has been set. func (o *GenericError) HasStatus() bool { - if o != nil && o.Status != nil { + if o != nil && !IsNil(o.Status) { return true } @@ -302,32 +309,75 @@ func (o *GenericError) SetStatus(v string) { } func (o GenericError) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GenericError) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Code != nil { + if !IsNil(o.Code) { toSerialize["code"] = o.Code } - if o.Debug != nil { + if !IsNil(o.Debug) { toSerialize["debug"] = o.Debug } - if o.Details != nil { + if !IsNil(o.Details) { toSerialize["details"] = o.Details } - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - if true { - toSerialize["message"] = o.Message - } - if o.Reason != nil { + toSerialize["message"] = o.Message + if !IsNil(o.Reason) { toSerialize["reason"] = o.Reason } - if o.Request != nil { + if !IsNil(o.Request) { toSerialize["request"] = o.Request } - if o.Status != nil { + if !IsNil(o.Status) { toSerialize["status"] = o.Status } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *GenericError) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "message", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varGenericError := _GenericError{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varGenericError) + + if err != nil { + return err + } + + *o = GenericError(varGenericError) + + return err } type NullableGenericError struct { diff --git a/internal/client-go/model_get_version_200_response.go b/internal/client-go/model_get_version_200_response.go index 7dc519c5fd9f..f966a79e3047 100644 --- a/internal/client-go/model_get_version_200_response.go +++ b/internal/client-go/model_get_version_200_response.go @@ -1,26 +1,33 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the GetVersion200Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetVersion200Response{} + // GetVersion200Response struct for GetVersion200Response type GetVersion200Response struct { // The version of Ory Kratos. Version string `json:"version"` } +type _GetVersion200Response GetVersion200Response + // NewGetVersion200Response instantiates a new GetVersion200Response object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -64,13 +71,56 @@ func (o *GetVersion200Response) SetVersion(v string) { } func (o GetVersion200Response) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["version"] = o.Version + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } return json.Marshal(toSerialize) } +func (o GetVersion200Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["version"] = o.Version + return toSerialize, nil +} + +func (o *GetVersion200Response) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "version", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varGetVersion200Response := _GetVersion200Response{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varGetVersion200Response) + + if err != nil { + return err + } + + *o = GetVersion200Response(varGetVersion200Response) + + return err +} + type NullableGetVersion200Response struct { value *GetVersion200Response isSet bool diff --git a/internal/client-go/model_health_not_ready_status.go b/internal/client-go/model_health_not_ready_status.go index 5ffd294a39e3..d28fad9024d6 100644 --- a/internal/client-go/model_health_not_ready_status.go +++ b/internal/client-go/model_health_not_ready_status.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the HealthNotReadyStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HealthNotReadyStatus{} + // HealthNotReadyStatus struct for HealthNotReadyStatus type HealthNotReadyStatus struct { // Errors contains a list of errors that caused the not ready status. @@ -40,7 +43,7 @@ func NewHealthNotReadyStatusWithDefaults() *HealthNotReadyStatus { // GetErrors returns the Errors field value if set, zero value otherwise. func (o *HealthNotReadyStatus) GetErrors() map[string]string { - if o == nil || o.Errors == nil { + if o == nil || IsNil(o.Errors) { var ret map[string]string return ret } @@ -50,7 +53,7 @@ func (o *HealthNotReadyStatus) GetErrors() map[string]string { // GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *HealthNotReadyStatus) GetErrorsOk() (*map[string]string, bool) { - if o == nil || o.Errors == nil { + if o == nil || IsNil(o.Errors) { return nil, false } return o.Errors, true @@ -58,7 +61,7 @@ func (o *HealthNotReadyStatus) GetErrorsOk() (*map[string]string, bool) { // HasErrors returns a boolean if a field has been set. func (o *HealthNotReadyStatus) HasErrors() bool { - if o != nil && o.Errors != nil { + if o != nil && !IsNil(o.Errors) { return true } @@ -71,11 +74,19 @@ func (o *HealthNotReadyStatus) SetErrors(v map[string]string) { } func (o HealthNotReadyStatus) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o HealthNotReadyStatus) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Errors != nil { + if !IsNil(o.Errors) { toSerialize["errors"] = o.Errors } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableHealthNotReadyStatus struct { diff --git a/internal/client-go/model_health_status.go b/internal/client-go/model_health_status.go index 8f7cd48ce896..4c9425a7c291 100644 --- a/internal/client-go/model_health_status.go +++ b/internal/client-go/model_health_status.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the HealthStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HealthStatus{} + // HealthStatus struct for HealthStatus type HealthStatus struct { // Status always contains \"ok\". @@ -40,7 +43,7 @@ func NewHealthStatusWithDefaults() *HealthStatus { // GetStatus returns the Status field value if set, zero value otherwise. func (o *HealthStatus) GetStatus() string { - if o == nil || o.Status == nil { + if o == nil || IsNil(o.Status) { var ret string return ret } @@ -50,7 +53,7 @@ func (o *HealthStatus) GetStatus() string { // GetStatusOk returns a tuple with the Status field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *HealthStatus) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { + if o == nil || IsNil(o.Status) { return nil, false } return o.Status, true @@ -58,7 +61,7 @@ func (o *HealthStatus) GetStatusOk() (*string, bool) { // HasStatus returns a boolean if a field has been set. func (o *HealthStatus) HasStatus() bool { - if o != nil && o.Status != nil { + if o != nil && !IsNil(o.Status) { return true } @@ -71,11 +74,19 @@ func (o *HealthStatus) SetStatus(v string) { } func (o HealthStatus) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o HealthStatus) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Status != nil { + if !IsNil(o.Status) { toSerialize["status"] = o.Status } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableHealthStatus struct { diff --git a/internal/client-go/model_identity.go b/internal/client-go/model_identity.go index cd939965877d..a7d656604de4 100644 --- a/internal/client-go/model_identity.go +++ b/internal/client-go/model_identity.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the Identity type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Identity{} + // Identity An [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) represents a (human) user in Ory. type Identity struct { // CreatedAt is a helper struct field for gobuffalo.pop. @@ -46,6 +51,8 @@ type Identity struct { VerifiableAddresses []VerifiableIdentityAddress `json:"verifiable_addresses,omitempty"` } +type _Identity Identity + // NewIdentity instantiates a new Identity object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -69,7 +76,7 @@ func NewIdentityWithDefaults() *Identity { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *Identity) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -79,7 +86,7 @@ func (o *Identity) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -87,7 +94,7 @@ func (o *Identity) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *Identity) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -101,7 +108,7 @@ func (o *Identity) SetCreatedAt(v time.Time) { // GetCredentials returns the Credentials field value if set, zero value otherwise. func (o *Identity) GetCredentials() map[string]IdentityCredentials { - if o == nil || o.Credentials == nil { + if o == nil || IsNil(o.Credentials) { var ret map[string]IdentityCredentials return ret } @@ -111,7 +118,7 @@ func (o *Identity) GetCredentials() map[string]IdentityCredentials { // GetCredentialsOk returns a tuple with the Credentials field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetCredentialsOk() (*map[string]IdentityCredentials, bool) { - if o == nil || o.Credentials == nil { + if o == nil || IsNil(o.Credentials) { return nil, false } return o.Credentials, true @@ -119,7 +126,7 @@ func (o *Identity) GetCredentialsOk() (*map[string]IdentityCredentials, bool) { // HasCredentials returns a boolean if a field has been set. func (o *Identity) HasCredentials() bool { - if o != nil && o.Credentials != nil { + if o != nil && !IsNil(o.Credentials) { return true } @@ -168,7 +175,7 @@ func (o *Identity) GetMetadataAdmin() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *Identity) GetMetadataAdminOk() (*interface{}, bool) { - if o == nil || o.MetadataAdmin == nil { + if o == nil || IsNil(o.MetadataAdmin) { return nil, false } return &o.MetadataAdmin, true @@ -176,7 +183,7 @@ func (o *Identity) GetMetadataAdminOk() (*interface{}, bool) { // HasMetadataAdmin returns a boolean if a field has been set. func (o *Identity) HasMetadataAdmin() bool { - if o != nil && o.MetadataAdmin != nil { + if o != nil && IsNil(o.MetadataAdmin) { return true } @@ -201,7 +208,7 @@ func (o *Identity) GetMetadataPublic() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *Identity) GetMetadataPublicOk() (*interface{}, bool) { - if o == nil || o.MetadataPublic == nil { + if o == nil || IsNil(o.MetadataPublic) { return nil, false } return &o.MetadataPublic, true @@ -209,7 +216,7 @@ func (o *Identity) GetMetadataPublicOk() (*interface{}, bool) { // HasMetadataPublic returns a boolean if a field has been set. func (o *Identity) HasMetadataPublic() bool { - if o != nil && o.MetadataPublic != nil { + if o != nil && IsNil(o.MetadataPublic) { return true } @@ -223,7 +230,7 @@ func (o *Identity) SetMetadataPublic(v interface{}) { // GetOrganizationId returns the OrganizationId field value if set, zero value otherwise (both if not set or set to explicit null). func (o *Identity) GetOrganizationId() string { - if o == nil || o.OrganizationId.Get() == nil { + if o == nil || IsNil(o.OrganizationId.Get()) { var ret string return ret } @@ -266,7 +273,7 @@ func (o *Identity) UnsetOrganizationId() { // GetRecoveryAddresses returns the RecoveryAddresses field value if set, zero value otherwise. func (o *Identity) GetRecoveryAddresses() []RecoveryIdentityAddress { - if o == nil || o.RecoveryAddresses == nil { + if o == nil || IsNil(o.RecoveryAddresses) { var ret []RecoveryIdentityAddress return ret } @@ -276,7 +283,7 @@ func (o *Identity) GetRecoveryAddresses() []RecoveryIdentityAddress { // GetRecoveryAddressesOk returns a tuple with the RecoveryAddresses field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetRecoveryAddressesOk() ([]RecoveryIdentityAddress, bool) { - if o == nil || o.RecoveryAddresses == nil { + if o == nil || IsNil(o.RecoveryAddresses) { return nil, false } return o.RecoveryAddresses, true @@ -284,7 +291,7 @@ func (o *Identity) GetRecoveryAddressesOk() ([]RecoveryIdentityAddress, bool) { // HasRecoveryAddresses returns a boolean if a field has been set. func (o *Identity) HasRecoveryAddresses() bool { - if o != nil && o.RecoveryAddresses != nil { + if o != nil && !IsNil(o.RecoveryAddresses) { return true } @@ -346,7 +353,7 @@ func (o *Identity) SetSchemaUrl(v string) { // GetState returns the State field value if set, zero value otherwise. func (o *Identity) GetState() string { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { var ret string return ret } @@ -356,7 +363,7 @@ func (o *Identity) GetState() string { // GetStateOk returns a tuple with the State field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetStateOk() (*string, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return o.State, true @@ -364,7 +371,7 @@ func (o *Identity) GetStateOk() (*string, bool) { // HasState returns a boolean if a field has been set. func (o *Identity) HasState() bool { - if o != nil && o.State != nil { + if o != nil && !IsNil(o.State) { return true } @@ -378,7 +385,7 @@ func (o *Identity) SetState(v string) { // GetStateChangedAt returns the StateChangedAt field value if set, zero value otherwise. func (o *Identity) GetStateChangedAt() time.Time { - if o == nil || o.StateChangedAt == nil { + if o == nil || IsNil(o.StateChangedAt) { var ret time.Time return ret } @@ -388,7 +395,7 @@ func (o *Identity) GetStateChangedAt() time.Time { // GetStateChangedAtOk returns a tuple with the StateChangedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetStateChangedAtOk() (*time.Time, bool) { - if o == nil || o.StateChangedAt == nil { + if o == nil || IsNil(o.StateChangedAt) { return nil, false } return o.StateChangedAt, true @@ -396,7 +403,7 @@ func (o *Identity) GetStateChangedAtOk() (*time.Time, bool) { // HasStateChangedAt returns a boolean if a field has been set. func (o *Identity) HasStateChangedAt() bool { - if o != nil && o.StateChangedAt != nil { + if o != nil && !IsNil(o.StateChangedAt) { return true } @@ -423,7 +430,7 @@ func (o *Identity) GetTraits() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *Identity) GetTraitsOk() (*interface{}, bool) { - if o == nil || o.Traits == nil { + if o == nil || IsNil(o.Traits) { return nil, false } return &o.Traits, true @@ -436,7 +443,7 @@ func (o *Identity) SetTraits(v interface{}) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *Identity) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -446,7 +453,7 @@ func (o *Identity) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -454,7 +461,7 @@ func (o *Identity) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *Identity) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -468,7 +475,7 @@ func (o *Identity) SetUpdatedAt(v time.Time) { // GetVerifiableAddresses returns the VerifiableAddresses field value if set, zero value otherwise. func (o *Identity) GetVerifiableAddresses() []VerifiableIdentityAddress { - if o == nil || o.VerifiableAddresses == nil { + if o == nil || IsNil(o.VerifiableAddresses) { var ret []VerifiableIdentityAddress return ret } @@ -478,7 +485,7 @@ func (o *Identity) GetVerifiableAddresses() []VerifiableIdentityAddress { // GetVerifiableAddressesOk returns a tuple with the VerifiableAddresses field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetVerifiableAddressesOk() ([]VerifiableIdentityAddress, bool) { - if o == nil || o.VerifiableAddresses == nil { + if o == nil || IsNil(o.VerifiableAddresses) { return nil, false } return o.VerifiableAddresses, true @@ -486,7 +493,7 @@ func (o *Identity) GetVerifiableAddressesOk() ([]VerifiableIdentityAddress, bool // HasVerifiableAddresses returns a boolean if a field has been set. func (o *Identity) HasVerifiableAddresses() bool { - if o != nil && o.VerifiableAddresses != nil { + if o != nil && !IsNil(o.VerifiableAddresses) { return true } @@ -499,16 +506,22 @@ func (o *Identity) SetVerifiableAddresses(v []VerifiableIdentityAddress) { } func (o Identity) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Identity) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if o.Credentials != nil { + if !IsNil(o.Credentials) { toSerialize["credentials"] = o.Credentials } - if true { - toSerialize["id"] = o.Id - } + toSerialize["id"] = o.Id if o.MetadataAdmin != nil { toSerialize["metadata_admin"] = o.MetadataAdmin } @@ -518,31 +531,67 @@ func (o Identity) MarshalJSON() ([]byte, error) { if o.OrganizationId.IsSet() { toSerialize["organization_id"] = o.OrganizationId.Get() } - if o.RecoveryAddresses != nil { + if !IsNil(o.RecoveryAddresses) { toSerialize["recovery_addresses"] = o.RecoveryAddresses } - if true { - toSerialize["schema_id"] = o.SchemaId - } - if true { - toSerialize["schema_url"] = o.SchemaUrl - } - if o.State != nil { + toSerialize["schema_id"] = o.SchemaId + toSerialize["schema_url"] = o.SchemaUrl + if !IsNil(o.State) { toSerialize["state"] = o.State } - if o.StateChangedAt != nil { + if !IsNil(o.StateChangedAt) { toSerialize["state_changed_at"] = o.StateChangedAt } if o.Traits != nil { toSerialize["traits"] = o.Traits } - if o.UpdatedAt != nil { + if !IsNil(o.UpdatedAt) { toSerialize["updated_at"] = o.UpdatedAt } - if o.VerifiableAddresses != nil { + if !IsNil(o.VerifiableAddresses) { toSerialize["verifiable_addresses"] = o.VerifiableAddresses } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *Identity) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "schema_id", + "schema_url", + "traits", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIdentity := _Identity{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIdentity) + + if err != nil { + return err + } + + *o = Identity(varIdentity) + + return err } type NullableIdentity struct { diff --git a/internal/client-go/model_identity_credentials.go b/internal/client-go/model_identity_credentials.go index 5b454383d520..2b4cda882921 100644 --- a/internal/client-go/model_identity_credentials.go +++ b/internal/client-go/model_identity_credentials.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -16,6 +16,9 @@ import ( "time" ) +// checks if the IdentityCredentials type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityCredentials{} + // IdentityCredentials Credentials represents a specific credential type type IdentityCredentials struct { Config map[string]interface{} `json:"config,omitempty"` @@ -50,7 +53,7 @@ func NewIdentityCredentialsWithDefaults() *IdentityCredentials { // GetConfig returns the Config field value if set, zero value otherwise. func (o *IdentityCredentials) GetConfig() map[string]interface{} { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { var ret map[string]interface{} return ret } @@ -60,15 +63,15 @@ func (o *IdentityCredentials) GetConfig() map[string]interface{} { // GetConfigOk returns a tuple with the Config field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentials) GetConfigOk() (map[string]interface{}, bool) { - if o == nil || o.Config == nil { - return nil, false + if o == nil || IsNil(o.Config) { + return map[string]interface{}{}, false } return o.Config, true } // HasConfig returns a boolean if a field has been set. func (o *IdentityCredentials) HasConfig() bool { - if o != nil && o.Config != nil { + if o != nil && !IsNil(o.Config) { return true } @@ -82,7 +85,7 @@ func (o *IdentityCredentials) SetConfig(v map[string]interface{}) { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *IdentityCredentials) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -92,7 +95,7 @@ func (o *IdentityCredentials) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentials) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -100,7 +103,7 @@ func (o *IdentityCredentials) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *IdentityCredentials) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -114,7 +117,7 @@ func (o *IdentityCredentials) SetCreatedAt(v time.Time) { // GetIdentifiers returns the Identifiers field value if set, zero value otherwise. func (o *IdentityCredentials) GetIdentifiers() []string { - if o == nil || o.Identifiers == nil { + if o == nil || IsNil(o.Identifiers) { var ret []string return ret } @@ -124,7 +127,7 @@ func (o *IdentityCredentials) GetIdentifiers() []string { // GetIdentifiersOk returns a tuple with the Identifiers field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentials) GetIdentifiersOk() ([]string, bool) { - if o == nil || o.Identifiers == nil { + if o == nil || IsNil(o.Identifiers) { return nil, false } return o.Identifiers, true @@ -132,7 +135,7 @@ func (o *IdentityCredentials) GetIdentifiersOk() ([]string, bool) { // HasIdentifiers returns a boolean if a field has been set. func (o *IdentityCredentials) HasIdentifiers() bool { - if o != nil && o.Identifiers != nil { + if o != nil && !IsNil(o.Identifiers) { return true } @@ -146,7 +149,7 @@ func (o *IdentityCredentials) SetIdentifiers(v []string) { // GetType returns the Type field value if set, zero value otherwise. func (o *IdentityCredentials) GetType() string { - if o == nil || o.Type == nil { + if o == nil || IsNil(o.Type) { var ret string return ret } @@ -156,7 +159,7 @@ func (o *IdentityCredentials) GetType() string { // GetTypeOk returns a tuple with the Type field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentials) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { + if o == nil || IsNil(o.Type) { return nil, false } return o.Type, true @@ -164,7 +167,7 @@ func (o *IdentityCredentials) GetTypeOk() (*string, bool) { // HasType returns a boolean if a field has been set. func (o *IdentityCredentials) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } @@ -178,7 +181,7 @@ func (o *IdentityCredentials) SetType(v string) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *IdentityCredentials) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -188,7 +191,7 @@ func (o *IdentityCredentials) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentials) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -196,7 +199,7 @@ func (o *IdentityCredentials) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *IdentityCredentials) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -210,7 +213,7 @@ func (o *IdentityCredentials) SetUpdatedAt(v time.Time) { // GetVersion returns the Version field value if set, zero value otherwise. func (o *IdentityCredentials) GetVersion() int64 { - if o == nil || o.Version == nil { + if o == nil || IsNil(o.Version) { var ret int64 return ret } @@ -220,7 +223,7 @@ func (o *IdentityCredentials) GetVersion() int64 { // GetVersionOk returns a tuple with the Version field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentials) GetVersionOk() (*int64, bool) { - if o == nil || o.Version == nil { + if o == nil || IsNil(o.Version) { return nil, false } return o.Version, true @@ -228,7 +231,7 @@ func (o *IdentityCredentials) GetVersionOk() (*int64, bool) { // HasVersion returns a boolean if a field has been set. func (o *IdentityCredentials) HasVersion() bool { - if o != nil && o.Version != nil { + if o != nil && !IsNil(o.Version) { return true } @@ -241,26 +244,34 @@ func (o *IdentityCredentials) SetVersion(v int64) { } func (o IdentityCredentials) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityCredentials) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Config != nil { + if !IsNil(o.Config) { toSerialize["config"] = o.Config } - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if o.Identifiers != nil { + if !IsNil(o.Identifiers) { toSerialize["identifiers"] = o.Identifiers } - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - if o.UpdatedAt != nil { + if !IsNil(o.UpdatedAt) { toSerialize["updated_at"] = o.UpdatedAt } - if o.Version != nil { + if !IsNil(o.Version) { toSerialize["version"] = o.Version } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityCredentials struct { diff --git a/internal/client-go/model_identity_credentials_code.go b/internal/client-go/model_identity_credentials_code.go index 75857f31c272..eb91f7f97933 100644 --- a/internal/client-go/model_identity_credentials_code.go +++ b/internal/client-go/model_identity_credentials_code.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -16,6 +16,9 @@ import ( "time" ) +// checks if the IdentityCredentialsCode type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityCredentialsCode{} + // IdentityCredentialsCode CredentialsCode represents a one time login/registration code type IdentityCredentialsCode struct { // The type of the address for this code @@ -42,7 +45,7 @@ func NewIdentityCredentialsCodeWithDefaults() *IdentityCredentialsCode { // GetAddressType returns the AddressType field value if set, zero value otherwise. func (o *IdentityCredentialsCode) GetAddressType() string { - if o == nil || o.AddressType == nil { + if o == nil || IsNil(o.AddressType) { var ret string return ret } @@ -52,7 +55,7 @@ func (o *IdentityCredentialsCode) GetAddressType() string { // GetAddressTypeOk returns a tuple with the AddressType field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsCode) GetAddressTypeOk() (*string, bool) { - if o == nil || o.AddressType == nil { + if o == nil || IsNil(o.AddressType) { return nil, false } return o.AddressType, true @@ -60,7 +63,7 @@ func (o *IdentityCredentialsCode) GetAddressTypeOk() (*string, bool) { // HasAddressType returns a boolean if a field has been set. func (o *IdentityCredentialsCode) HasAddressType() bool { - if o != nil && o.AddressType != nil { + if o != nil && !IsNil(o.AddressType) { return true } @@ -74,7 +77,7 @@ func (o *IdentityCredentialsCode) SetAddressType(v string) { // GetUsedAt returns the UsedAt field value if set, zero value otherwise (both if not set or set to explicit null). func (o *IdentityCredentialsCode) GetUsedAt() time.Time { - if o == nil || o.UsedAt.Get() == nil { + if o == nil || IsNil(o.UsedAt.Get()) { var ret time.Time return ret } @@ -116,14 +119,22 @@ func (o *IdentityCredentialsCode) UnsetUsedAt() { } func (o IdentityCredentialsCode) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityCredentialsCode) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.AddressType != nil { + if !IsNil(o.AddressType) { toSerialize["address_type"] = o.AddressType } if o.UsedAt.IsSet() { toSerialize["used_at"] = o.UsedAt.Get() } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityCredentialsCode struct { diff --git a/internal/client-go/model_identity_credentials_oidc.go b/internal/client-go/model_identity_credentials_oidc.go index ffb2dfadaa14..db3f2cf74716 100644 --- a/internal/client-go/model_identity_credentials_oidc.go +++ b/internal/client-go/model_identity_credentials_oidc.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityCredentialsOidc type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityCredentialsOidc{} + // IdentityCredentialsOidc struct for IdentityCredentialsOidc type IdentityCredentialsOidc struct { Providers []IdentityCredentialsOidcProvider `json:"providers,omitempty"` @@ -39,7 +42,7 @@ func NewIdentityCredentialsOidcWithDefaults() *IdentityCredentialsOidc { // GetProviders returns the Providers field value if set, zero value otherwise. func (o *IdentityCredentialsOidc) GetProviders() []IdentityCredentialsOidcProvider { - if o == nil || o.Providers == nil { + if o == nil || IsNil(o.Providers) { var ret []IdentityCredentialsOidcProvider return ret } @@ -49,7 +52,7 @@ func (o *IdentityCredentialsOidc) GetProviders() []IdentityCredentialsOidcProvid // GetProvidersOk returns a tuple with the Providers field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidc) GetProvidersOk() ([]IdentityCredentialsOidcProvider, bool) { - if o == nil || o.Providers == nil { + if o == nil || IsNil(o.Providers) { return nil, false } return o.Providers, true @@ -57,7 +60,7 @@ func (o *IdentityCredentialsOidc) GetProvidersOk() ([]IdentityCredentialsOidcPro // HasProviders returns a boolean if a field has been set. func (o *IdentityCredentialsOidc) HasProviders() bool { - if o != nil && o.Providers != nil { + if o != nil && !IsNil(o.Providers) { return true } @@ -70,11 +73,19 @@ func (o *IdentityCredentialsOidc) SetProviders(v []IdentityCredentialsOidcProvid } func (o IdentityCredentialsOidc) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityCredentialsOidc) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Providers != nil { + if !IsNil(o.Providers) { toSerialize["providers"] = o.Providers } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityCredentialsOidc struct { diff --git a/internal/client-go/model_identity_credentials_oidc_provider.go b/internal/client-go/model_identity_credentials_oidc_provider.go index f905f2f60413..06c433b232a6 100644 --- a/internal/client-go/model_identity_credentials_oidc_provider.go +++ b/internal/client-go/model_identity_credentials_oidc_provider.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityCredentialsOidcProvider type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityCredentialsOidcProvider{} + // IdentityCredentialsOidcProvider struct for IdentityCredentialsOidcProvider type IdentityCredentialsOidcProvider struct { InitialAccessToken *string `json:"initial_access_token,omitempty"` @@ -44,7 +47,7 @@ func NewIdentityCredentialsOidcProviderWithDefaults() *IdentityCredentialsOidcPr // GetInitialAccessToken returns the InitialAccessToken field value if set, zero value otherwise. func (o *IdentityCredentialsOidcProvider) GetInitialAccessToken() string { - if o == nil || o.InitialAccessToken == nil { + if o == nil || IsNil(o.InitialAccessToken) { var ret string return ret } @@ -54,7 +57,7 @@ func (o *IdentityCredentialsOidcProvider) GetInitialAccessToken() string { // GetInitialAccessTokenOk returns a tuple with the InitialAccessToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidcProvider) GetInitialAccessTokenOk() (*string, bool) { - if o == nil || o.InitialAccessToken == nil { + if o == nil || IsNil(o.InitialAccessToken) { return nil, false } return o.InitialAccessToken, true @@ -62,7 +65,7 @@ func (o *IdentityCredentialsOidcProvider) GetInitialAccessTokenOk() (*string, bo // HasInitialAccessToken returns a boolean if a field has been set. func (o *IdentityCredentialsOidcProvider) HasInitialAccessToken() bool { - if o != nil && o.InitialAccessToken != nil { + if o != nil && !IsNil(o.InitialAccessToken) { return true } @@ -76,7 +79,7 @@ func (o *IdentityCredentialsOidcProvider) SetInitialAccessToken(v string) { // GetInitialIdToken returns the InitialIdToken field value if set, zero value otherwise. func (o *IdentityCredentialsOidcProvider) GetInitialIdToken() string { - if o == nil || o.InitialIdToken == nil { + if o == nil || IsNil(o.InitialIdToken) { var ret string return ret } @@ -86,7 +89,7 @@ func (o *IdentityCredentialsOidcProvider) GetInitialIdToken() string { // GetInitialIdTokenOk returns a tuple with the InitialIdToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidcProvider) GetInitialIdTokenOk() (*string, bool) { - if o == nil || o.InitialIdToken == nil { + if o == nil || IsNil(o.InitialIdToken) { return nil, false } return o.InitialIdToken, true @@ -94,7 +97,7 @@ func (o *IdentityCredentialsOidcProvider) GetInitialIdTokenOk() (*string, bool) // HasInitialIdToken returns a boolean if a field has been set. func (o *IdentityCredentialsOidcProvider) HasInitialIdToken() bool { - if o != nil && o.InitialIdToken != nil { + if o != nil && !IsNil(o.InitialIdToken) { return true } @@ -108,7 +111,7 @@ func (o *IdentityCredentialsOidcProvider) SetInitialIdToken(v string) { // GetInitialRefreshToken returns the InitialRefreshToken field value if set, zero value otherwise. func (o *IdentityCredentialsOidcProvider) GetInitialRefreshToken() string { - if o == nil || o.InitialRefreshToken == nil { + if o == nil || IsNil(o.InitialRefreshToken) { var ret string return ret } @@ -118,7 +121,7 @@ func (o *IdentityCredentialsOidcProvider) GetInitialRefreshToken() string { // GetInitialRefreshTokenOk returns a tuple with the InitialRefreshToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidcProvider) GetInitialRefreshTokenOk() (*string, bool) { - if o == nil || o.InitialRefreshToken == nil { + if o == nil || IsNil(o.InitialRefreshToken) { return nil, false } return o.InitialRefreshToken, true @@ -126,7 +129,7 @@ func (o *IdentityCredentialsOidcProvider) GetInitialRefreshTokenOk() (*string, b // HasInitialRefreshToken returns a boolean if a field has been set. func (o *IdentityCredentialsOidcProvider) HasInitialRefreshToken() bool { - if o != nil && o.InitialRefreshToken != nil { + if o != nil && !IsNil(o.InitialRefreshToken) { return true } @@ -140,7 +143,7 @@ func (o *IdentityCredentialsOidcProvider) SetInitialRefreshToken(v string) { // GetOrganization returns the Organization field value if set, zero value otherwise. func (o *IdentityCredentialsOidcProvider) GetOrganization() string { - if o == nil || o.Organization == nil { + if o == nil || IsNil(o.Organization) { var ret string return ret } @@ -150,7 +153,7 @@ func (o *IdentityCredentialsOidcProvider) GetOrganization() string { // GetOrganizationOk returns a tuple with the Organization field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidcProvider) GetOrganizationOk() (*string, bool) { - if o == nil || o.Organization == nil { + if o == nil || IsNil(o.Organization) { return nil, false } return o.Organization, true @@ -158,7 +161,7 @@ func (o *IdentityCredentialsOidcProvider) GetOrganizationOk() (*string, bool) { // HasOrganization returns a boolean if a field has been set. func (o *IdentityCredentialsOidcProvider) HasOrganization() bool { - if o != nil && o.Organization != nil { + if o != nil && !IsNil(o.Organization) { return true } @@ -172,7 +175,7 @@ func (o *IdentityCredentialsOidcProvider) SetOrganization(v string) { // GetProvider returns the Provider field value if set, zero value otherwise. func (o *IdentityCredentialsOidcProvider) GetProvider() string { - if o == nil || o.Provider == nil { + if o == nil || IsNil(o.Provider) { var ret string return ret } @@ -182,7 +185,7 @@ func (o *IdentityCredentialsOidcProvider) GetProvider() string { // GetProviderOk returns a tuple with the Provider field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidcProvider) GetProviderOk() (*string, bool) { - if o == nil || o.Provider == nil { + if o == nil || IsNil(o.Provider) { return nil, false } return o.Provider, true @@ -190,7 +193,7 @@ func (o *IdentityCredentialsOidcProvider) GetProviderOk() (*string, bool) { // HasProvider returns a boolean if a field has been set. func (o *IdentityCredentialsOidcProvider) HasProvider() bool { - if o != nil && o.Provider != nil { + if o != nil && !IsNil(o.Provider) { return true } @@ -204,7 +207,7 @@ func (o *IdentityCredentialsOidcProvider) SetProvider(v string) { // GetSubject returns the Subject field value if set, zero value otherwise. func (o *IdentityCredentialsOidcProvider) GetSubject() string { - if o == nil || o.Subject == nil { + if o == nil || IsNil(o.Subject) { var ret string return ret } @@ -214,7 +217,7 @@ func (o *IdentityCredentialsOidcProvider) GetSubject() string { // GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidcProvider) GetSubjectOk() (*string, bool) { - if o == nil || o.Subject == nil { + if o == nil || IsNil(o.Subject) { return nil, false } return o.Subject, true @@ -222,7 +225,7 @@ func (o *IdentityCredentialsOidcProvider) GetSubjectOk() (*string, bool) { // HasSubject returns a boolean if a field has been set. func (o *IdentityCredentialsOidcProvider) HasSubject() bool { - if o != nil && o.Subject != nil { + if o != nil && !IsNil(o.Subject) { return true } @@ -235,26 +238,34 @@ func (o *IdentityCredentialsOidcProvider) SetSubject(v string) { } func (o IdentityCredentialsOidcProvider) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityCredentialsOidcProvider) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.InitialAccessToken != nil { + if !IsNil(o.InitialAccessToken) { toSerialize["initial_access_token"] = o.InitialAccessToken } - if o.InitialIdToken != nil { + if !IsNil(o.InitialIdToken) { toSerialize["initial_id_token"] = o.InitialIdToken } - if o.InitialRefreshToken != nil { + if !IsNil(o.InitialRefreshToken) { toSerialize["initial_refresh_token"] = o.InitialRefreshToken } - if o.Organization != nil { + if !IsNil(o.Organization) { toSerialize["organization"] = o.Organization } - if o.Provider != nil { + if !IsNil(o.Provider) { toSerialize["provider"] = o.Provider } - if o.Subject != nil { + if !IsNil(o.Subject) { toSerialize["subject"] = o.Subject } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityCredentialsOidcProvider struct { diff --git a/internal/client-go/model_identity_credentials_password.go b/internal/client-go/model_identity_credentials_password.go index 85f942fb6852..0edf148e37c7 100644 --- a/internal/client-go/model_identity_credentials_password.go +++ b/internal/client-go/model_identity_credentials_password.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityCredentialsPassword type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityCredentialsPassword{} + // IdentityCredentialsPassword struct for IdentityCredentialsPassword type IdentityCredentialsPassword struct { // HashedPassword is a hash-representation of the password. @@ -40,7 +43,7 @@ func NewIdentityCredentialsPasswordWithDefaults() *IdentityCredentialsPassword { // GetHashedPassword returns the HashedPassword field value if set, zero value otherwise. func (o *IdentityCredentialsPassword) GetHashedPassword() string { - if o == nil || o.HashedPassword == nil { + if o == nil || IsNil(o.HashedPassword) { var ret string return ret } @@ -50,7 +53,7 @@ func (o *IdentityCredentialsPassword) GetHashedPassword() string { // GetHashedPasswordOk returns a tuple with the HashedPassword field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsPassword) GetHashedPasswordOk() (*string, bool) { - if o == nil || o.HashedPassword == nil { + if o == nil || IsNil(o.HashedPassword) { return nil, false } return o.HashedPassword, true @@ -58,7 +61,7 @@ func (o *IdentityCredentialsPassword) GetHashedPasswordOk() (*string, bool) { // HasHashedPassword returns a boolean if a field has been set. func (o *IdentityCredentialsPassword) HasHashedPassword() bool { - if o != nil && o.HashedPassword != nil { + if o != nil && !IsNil(o.HashedPassword) { return true } @@ -71,11 +74,19 @@ func (o *IdentityCredentialsPassword) SetHashedPassword(v string) { } func (o IdentityCredentialsPassword) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityCredentialsPassword) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.HashedPassword != nil { + if !IsNil(o.HashedPassword) { toSerialize["hashed_password"] = o.HashedPassword } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityCredentialsPassword struct { diff --git a/internal/client-go/model_identity_patch.go b/internal/client-go/model_identity_patch.go index d621e34d458f..596040c0be52 100644 --- a/internal/client-go/model_identity_patch.go +++ b/internal/client-go/model_identity_patch.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityPatch{} + // IdentityPatch Payload for patching an identity type IdentityPatch struct { Create *CreateIdentityBody `json:"create,omitempty"` @@ -41,7 +44,7 @@ func NewIdentityPatchWithDefaults() *IdentityPatch { // GetCreate returns the Create field value if set, zero value otherwise. func (o *IdentityPatch) GetCreate() CreateIdentityBody { - if o == nil || o.Create == nil { + if o == nil || IsNil(o.Create) { var ret CreateIdentityBody return ret } @@ -51,7 +54,7 @@ func (o *IdentityPatch) GetCreate() CreateIdentityBody { // GetCreateOk returns a tuple with the Create field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityPatch) GetCreateOk() (*CreateIdentityBody, bool) { - if o == nil || o.Create == nil { + if o == nil || IsNil(o.Create) { return nil, false } return o.Create, true @@ -59,7 +62,7 @@ func (o *IdentityPatch) GetCreateOk() (*CreateIdentityBody, bool) { // HasCreate returns a boolean if a field has been set. func (o *IdentityPatch) HasCreate() bool { - if o != nil && o.Create != nil { + if o != nil && !IsNil(o.Create) { return true } @@ -73,7 +76,7 @@ func (o *IdentityPatch) SetCreate(v CreateIdentityBody) { // GetPatchId returns the PatchId field value if set, zero value otherwise. func (o *IdentityPatch) GetPatchId() string { - if o == nil || o.PatchId == nil { + if o == nil || IsNil(o.PatchId) { var ret string return ret } @@ -83,7 +86,7 @@ func (o *IdentityPatch) GetPatchId() string { // GetPatchIdOk returns a tuple with the PatchId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityPatch) GetPatchIdOk() (*string, bool) { - if o == nil || o.PatchId == nil { + if o == nil || IsNil(o.PatchId) { return nil, false } return o.PatchId, true @@ -91,7 +94,7 @@ func (o *IdentityPatch) GetPatchIdOk() (*string, bool) { // HasPatchId returns a boolean if a field has been set. func (o *IdentityPatch) HasPatchId() bool { - if o != nil && o.PatchId != nil { + if o != nil && !IsNil(o.PatchId) { return true } @@ -104,14 +107,22 @@ func (o *IdentityPatch) SetPatchId(v string) { } func (o IdentityPatch) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityPatch) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Create != nil { + if !IsNil(o.Create) { toSerialize["create"] = o.Create } - if o.PatchId != nil { + if !IsNil(o.PatchId) { toSerialize["patch_id"] = o.PatchId } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityPatch struct { diff --git a/internal/client-go/model_identity_patch_response.go b/internal/client-go/model_identity_patch_response.go index 2ee305f7da81..9021de0f405c 100644 --- a/internal/client-go/model_identity_patch_response.go +++ b/internal/client-go/model_identity_patch_response.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityPatchResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityPatchResponse{} + // IdentityPatchResponse Response for a single identity patch type IdentityPatchResponse struct { // The action for this specific patch create ActionCreate Create this identity. @@ -44,7 +47,7 @@ func NewIdentityPatchResponseWithDefaults() *IdentityPatchResponse { // GetAction returns the Action field value if set, zero value otherwise. func (o *IdentityPatchResponse) GetAction() string { - if o == nil || o.Action == nil { + if o == nil || IsNil(o.Action) { var ret string return ret } @@ -54,7 +57,7 @@ func (o *IdentityPatchResponse) GetAction() string { // GetActionOk returns a tuple with the Action field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityPatchResponse) GetActionOk() (*string, bool) { - if o == nil || o.Action == nil { + if o == nil || IsNil(o.Action) { return nil, false } return o.Action, true @@ -62,7 +65,7 @@ func (o *IdentityPatchResponse) GetActionOk() (*string, bool) { // HasAction returns a boolean if a field has been set. func (o *IdentityPatchResponse) HasAction() bool { - if o != nil && o.Action != nil { + if o != nil && !IsNil(o.Action) { return true } @@ -76,7 +79,7 @@ func (o *IdentityPatchResponse) SetAction(v string) { // GetIdentity returns the Identity field value if set, zero value otherwise. func (o *IdentityPatchResponse) GetIdentity() string { - if o == nil || o.Identity == nil { + if o == nil || IsNil(o.Identity) { var ret string return ret } @@ -86,7 +89,7 @@ func (o *IdentityPatchResponse) GetIdentity() string { // GetIdentityOk returns a tuple with the Identity field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityPatchResponse) GetIdentityOk() (*string, bool) { - if o == nil || o.Identity == nil { + if o == nil || IsNil(o.Identity) { return nil, false } return o.Identity, true @@ -94,7 +97,7 @@ func (o *IdentityPatchResponse) GetIdentityOk() (*string, bool) { // HasIdentity returns a boolean if a field has been set. func (o *IdentityPatchResponse) HasIdentity() bool { - if o != nil && o.Identity != nil { + if o != nil && !IsNil(o.Identity) { return true } @@ -108,7 +111,7 @@ func (o *IdentityPatchResponse) SetIdentity(v string) { // GetPatchId returns the PatchId field value if set, zero value otherwise. func (o *IdentityPatchResponse) GetPatchId() string { - if o == nil || o.PatchId == nil { + if o == nil || IsNil(o.PatchId) { var ret string return ret } @@ -118,7 +121,7 @@ func (o *IdentityPatchResponse) GetPatchId() string { // GetPatchIdOk returns a tuple with the PatchId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityPatchResponse) GetPatchIdOk() (*string, bool) { - if o == nil || o.PatchId == nil { + if o == nil || IsNil(o.PatchId) { return nil, false } return o.PatchId, true @@ -126,7 +129,7 @@ func (o *IdentityPatchResponse) GetPatchIdOk() (*string, bool) { // HasPatchId returns a boolean if a field has been set. func (o *IdentityPatchResponse) HasPatchId() bool { - if o != nil && o.PatchId != nil { + if o != nil && !IsNil(o.PatchId) { return true } @@ -139,17 +142,25 @@ func (o *IdentityPatchResponse) SetPatchId(v string) { } func (o IdentityPatchResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityPatchResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Action != nil { + if !IsNil(o.Action) { toSerialize["action"] = o.Action } - if o.Identity != nil { + if !IsNil(o.Identity) { toSerialize["identity"] = o.Identity } - if o.PatchId != nil { + if !IsNil(o.PatchId) { toSerialize["patch_id"] = o.PatchId } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityPatchResponse struct { diff --git a/internal/client-go/model_identity_schema_container.go b/internal/client-go/model_identity_schema_container.go index d25bd30ab716..331f4662f20b 100644 --- a/internal/client-go/model_identity_schema_container.go +++ b/internal/client-go/model_identity_schema_container.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentitySchemaContainer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentitySchemaContainer{} + // IdentitySchemaContainer An Identity JSON Schema Container type IdentitySchemaContainer struct { // The ID of the Identity JSON Schema @@ -42,7 +45,7 @@ func NewIdentitySchemaContainerWithDefaults() *IdentitySchemaContainer { // GetId returns the Id field value if set, zero value otherwise. func (o *IdentitySchemaContainer) GetId() string { - if o == nil || o.Id == nil { + if o == nil || IsNil(o.Id) { var ret string return ret } @@ -52,7 +55,7 @@ func (o *IdentitySchemaContainer) GetId() string { // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentitySchemaContainer) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { + if o == nil || IsNil(o.Id) { return nil, false } return o.Id, true @@ -60,7 +63,7 @@ func (o *IdentitySchemaContainer) GetIdOk() (*string, bool) { // HasId returns a boolean if a field has been set. func (o *IdentitySchemaContainer) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } @@ -74,7 +77,7 @@ func (o *IdentitySchemaContainer) SetId(v string) { // GetSchema returns the Schema field value if set, zero value otherwise. func (o *IdentitySchemaContainer) GetSchema() map[string]interface{} { - if o == nil || o.Schema == nil { + if o == nil || IsNil(o.Schema) { var ret map[string]interface{} return ret } @@ -84,15 +87,15 @@ func (o *IdentitySchemaContainer) GetSchema() map[string]interface{} { // GetSchemaOk returns a tuple with the Schema field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentitySchemaContainer) GetSchemaOk() (map[string]interface{}, bool) { - if o == nil || o.Schema == nil { - return nil, false + if o == nil || IsNil(o.Schema) { + return map[string]interface{}{}, false } return o.Schema, true } // HasSchema returns a boolean if a field has been set. func (o *IdentitySchemaContainer) HasSchema() bool { - if o != nil && o.Schema != nil { + if o != nil && !IsNil(o.Schema) { return true } @@ -105,14 +108,22 @@ func (o *IdentitySchemaContainer) SetSchema(v map[string]interface{}) { } func (o IdentitySchemaContainer) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentitySchemaContainer) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - if o.Schema != nil { + if !IsNil(o.Schema) { toSerialize["schema"] = o.Schema } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentitySchemaContainer struct { diff --git a/internal/client-go/model_identity_with_credentials.go b/internal/client-go/model_identity_with_credentials.go index 74e0d2651633..66645005e9fa 100644 --- a/internal/client-go/model_identity_with_credentials.go +++ b/internal/client-go/model_identity_with_credentials.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityWithCredentials type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityWithCredentials{} + // IdentityWithCredentials Create Identity and Import Credentials type IdentityWithCredentials struct { Oidc *IdentityWithCredentialsOidc `json:"oidc,omitempty"` @@ -40,7 +43,7 @@ func NewIdentityWithCredentialsWithDefaults() *IdentityWithCredentials { // GetOidc returns the Oidc field value if set, zero value otherwise. func (o *IdentityWithCredentials) GetOidc() IdentityWithCredentialsOidc { - if o == nil || o.Oidc == nil { + if o == nil || IsNil(o.Oidc) { var ret IdentityWithCredentialsOidc return ret } @@ -50,7 +53,7 @@ func (o *IdentityWithCredentials) GetOidc() IdentityWithCredentialsOidc { // GetOidcOk returns a tuple with the Oidc field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentials) GetOidcOk() (*IdentityWithCredentialsOidc, bool) { - if o == nil || o.Oidc == nil { + if o == nil || IsNil(o.Oidc) { return nil, false } return o.Oidc, true @@ -58,7 +61,7 @@ func (o *IdentityWithCredentials) GetOidcOk() (*IdentityWithCredentialsOidc, boo // HasOidc returns a boolean if a field has been set. func (o *IdentityWithCredentials) HasOidc() bool { - if o != nil && o.Oidc != nil { + if o != nil && !IsNil(o.Oidc) { return true } @@ -72,7 +75,7 @@ func (o *IdentityWithCredentials) SetOidc(v IdentityWithCredentialsOidc) { // GetPassword returns the Password field value if set, zero value otherwise. func (o *IdentityWithCredentials) GetPassword() IdentityWithCredentialsPassword { - if o == nil || o.Password == nil { + if o == nil || IsNil(o.Password) { var ret IdentityWithCredentialsPassword return ret } @@ -82,7 +85,7 @@ func (o *IdentityWithCredentials) GetPassword() IdentityWithCredentialsPassword // GetPasswordOk returns a tuple with the Password field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentials) GetPasswordOk() (*IdentityWithCredentialsPassword, bool) { - if o == nil || o.Password == nil { + if o == nil || IsNil(o.Password) { return nil, false } return o.Password, true @@ -90,7 +93,7 @@ func (o *IdentityWithCredentials) GetPasswordOk() (*IdentityWithCredentialsPassw // HasPassword returns a boolean if a field has been set. func (o *IdentityWithCredentials) HasPassword() bool { - if o != nil && o.Password != nil { + if o != nil && !IsNil(o.Password) { return true } @@ -103,14 +106,22 @@ func (o *IdentityWithCredentials) SetPassword(v IdentityWithCredentialsPassword) } func (o IdentityWithCredentials) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityWithCredentials) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Oidc != nil { + if !IsNil(o.Oidc) { toSerialize["oidc"] = o.Oidc } - if o.Password != nil { + if !IsNil(o.Password) { toSerialize["password"] = o.Password } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityWithCredentials struct { diff --git a/internal/client-go/model_identity_with_credentials_oidc.go b/internal/client-go/model_identity_with_credentials_oidc.go index afa70faa97e0..ee6fd86225d1 100644 --- a/internal/client-go/model_identity_with_credentials_oidc.go +++ b/internal/client-go/model_identity_with_credentials_oidc.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityWithCredentialsOidc type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityWithCredentialsOidc{} + // IdentityWithCredentialsOidc Create Identity and Import Social Sign In Credentials type IdentityWithCredentialsOidc struct { Config *IdentityWithCredentialsOidcConfig `json:"config,omitempty"` @@ -39,7 +42,7 @@ func NewIdentityWithCredentialsOidcWithDefaults() *IdentityWithCredentialsOidc { // GetConfig returns the Config field value if set, zero value otherwise. func (o *IdentityWithCredentialsOidc) GetConfig() IdentityWithCredentialsOidcConfig { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { var ret IdentityWithCredentialsOidcConfig return ret } @@ -49,7 +52,7 @@ func (o *IdentityWithCredentialsOidc) GetConfig() IdentityWithCredentialsOidcCon // GetConfigOk returns a tuple with the Config field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentialsOidc) GetConfigOk() (*IdentityWithCredentialsOidcConfig, bool) { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { return nil, false } return o.Config, true @@ -57,7 +60,7 @@ func (o *IdentityWithCredentialsOidc) GetConfigOk() (*IdentityWithCredentialsOid // HasConfig returns a boolean if a field has been set. func (o *IdentityWithCredentialsOidc) HasConfig() bool { - if o != nil && o.Config != nil { + if o != nil && !IsNil(o.Config) { return true } @@ -70,11 +73,19 @@ func (o *IdentityWithCredentialsOidc) SetConfig(v IdentityWithCredentialsOidcCon } func (o IdentityWithCredentialsOidc) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityWithCredentialsOidc) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Config != nil { + if !IsNil(o.Config) { toSerialize["config"] = o.Config } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityWithCredentialsOidc struct { diff --git a/internal/client-go/model_identity_with_credentials_oidc_config.go b/internal/client-go/model_identity_with_credentials_oidc_config.go index 51440cb44092..abec0e301538 100644 --- a/internal/client-go/model_identity_with_credentials_oidc_config.go +++ b/internal/client-go/model_identity_with_credentials_oidc_config.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityWithCredentialsOidcConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityWithCredentialsOidcConfig{} + // IdentityWithCredentialsOidcConfig struct for IdentityWithCredentialsOidcConfig type IdentityWithCredentialsOidcConfig struct { Config *IdentityWithCredentialsPasswordConfig `json:"config,omitempty"` @@ -41,7 +44,7 @@ func NewIdentityWithCredentialsOidcConfigWithDefaults() *IdentityWithCredentials // GetConfig returns the Config field value if set, zero value otherwise. func (o *IdentityWithCredentialsOidcConfig) GetConfig() IdentityWithCredentialsPasswordConfig { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { var ret IdentityWithCredentialsPasswordConfig return ret } @@ -51,7 +54,7 @@ func (o *IdentityWithCredentialsOidcConfig) GetConfig() IdentityWithCredentialsP // GetConfigOk returns a tuple with the Config field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentialsOidcConfig) GetConfigOk() (*IdentityWithCredentialsPasswordConfig, bool) { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { return nil, false } return o.Config, true @@ -59,7 +62,7 @@ func (o *IdentityWithCredentialsOidcConfig) GetConfigOk() (*IdentityWithCredenti // HasConfig returns a boolean if a field has been set. func (o *IdentityWithCredentialsOidcConfig) HasConfig() bool { - if o != nil && o.Config != nil { + if o != nil && !IsNil(o.Config) { return true } @@ -73,7 +76,7 @@ func (o *IdentityWithCredentialsOidcConfig) SetConfig(v IdentityWithCredentialsP // GetProviders returns the Providers field value if set, zero value otherwise. func (o *IdentityWithCredentialsOidcConfig) GetProviders() []IdentityWithCredentialsOidcConfigProvider { - if o == nil || o.Providers == nil { + if o == nil || IsNil(o.Providers) { var ret []IdentityWithCredentialsOidcConfigProvider return ret } @@ -83,7 +86,7 @@ func (o *IdentityWithCredentialsOidcConfig) GetProviders() []IdentityWithCredent // GetProvidersOk returns a tuple with the Providers field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentialsOidcConfig) GetProvidersOk() ([]IdentityWithCredentialsOidcConfigProvider, bool) { - if o == nil || o.Providers == nil { + if o == nil || IsNil(o.Providers) { return nil, false } return o.Providers, true @@ -91,7 +94,7 @@ func (o *IdentityWithCredentialsOidcConfig) GetProvidersOk() ([]IdentityWithCred // HasProviders returns a boolean if a field has been set. func (o *IdentityWithCredentialsOidcConfig) HasProviders() bool { - if o != nil && o.Providers != nil { + if o != nil && !IsNil(o.Providers) { return true } @@ -104,14 +107,22 @@ func (o *IdentityWithCredentialsOidcConfig) SetProviders(v []IdentityWithCredent } func (o IdentityWithCredentialsOidcConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityWithCredentialsOidcConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Config != nil { + if !IsNil(o.Config) { toSerialize["config"] = o.Config } - if o.Providers != nil { + if !IsNil(o.Providers) { toSerialize["providers"] = o.Providers } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityWithCredentialsOidcConfig struct { diff --git a/internal/client-go/model_identity_with_credentials_oidc_config_provider.go b/internal/client-go/model_identity_with_credentials_oidc_config_provider.go index a12405169aef..f2308d8ab376 100644 --- a/internal/client-go/model_identity_with_credentials_oidc_config_provider.go +++ b/internal/client-go/model_identity_with_credentials_oidc_config_provider.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the IdentityWithCredentialsOidcConfigProvider type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityWithCredentialsOidcConfigProvider{} + // IdentityWithCredentialsOidcConfigProvider Create Identity and Import Social Sign In Credentials Configuration type IdentityWithCredentialsOidcConfigProvider struct { // The OpenID Connect provider to link the subject to. Usually something like `google` or `github`. @@ -23,6 +28,8 @@ type IdentityWithCredentialsOidcConfigProvider struct { Subject string `json:"subject"` } +type _IdentityWithCredentialsOidcConfigProvider IdentityWithCredentialsOidcConfigProvider + // NewIdentityWithCredentialsOidcConfigProvider instantiates a new IdentityWithCredentialsOidcConfigProvider object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -91,14 +98,56 @@ func (o *IdentityWithCredentialsOidcConfigProvider) SetSubject(v string) { } func (o IdentityWithCredentialsOidcConfigProvider) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityWithCredentialsOidcConfigProvider) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["provider"] = o.Provider + toSerialize["provider"] = o.Provider + toSerialize["subject"] = o.Subject + return toSerialize, nil +} + +func (o *IdentityWithCredentialsOidcConfigProvider) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "provider", + "subject", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["subject"] = o.Subject + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varIdentityWithCredentialsOidcConfigProvider := _IdentityWithCredentialsOidcConfigProvider{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIdentityWithCredentialsOidcConfigProvider) + + if err != nil { + return err + } + + *o = IdentityWithCredentialsOidcConfigProvider(varIdentityWithCredentialsOidcConfigProvider) + + return err } type NullableIdentityWithCredentialsOidcConfigProvider struct { diff --git a/internal/client-go/model_identity_with_credentials_password.go b/internal/client-go/model_identity_with_credentials_password.go index ca5a7bd46195..cae6b8dae2d1 100644 --- a/internal/client-go/model_identity_with_credentials_password.go +++ b/internal/client-go/model_identity_with_credentials_password.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityWithCredentialsPassword type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityWithCredentialsPassword{} + // IdentityWithCredentialsPassword Create Identity and Import Password Credentials type IdentityWithCredentialsPassword struct { Config *IdentityWithCredentialsPasswordConfig `json:"config,omitempty"` @@ -39,7 +42,7 @@ func NewIdentityWithCredentialsPasswordWithDefaults() *IdentityWithCredentialsPa // GetConfig returns the Config field value if set, zero value otherwise. func (o *IdentityWithCredentialsPassword) GetConfig() IdentityWithCredentialsPasswordConfig { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { var ret IdentityWithCredentialsPasswordConfig return ret } @@ -49,7 +52,7 @@ func (o *IdentityWithCredentialsPassword) GetConfig() IdentityWithCredentialsPas // GetConfigOk returns a tuple with the Config field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentialsPassword) GetConfigOk() (*IdentityWithCredentialsPasswordConfig, bool) { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { return nil, false } return o.Config, true @@ -57,7 +60,7 @@ func (o *IdentityWithCredentialsPassword) GetConfigOk() (*IdentityWithCredential // HasConfig returns a boolean if a field has been set. func (o *IdentityWithCredentialsPassword) HasConfig() bool { - if o != nil && o.Config != nil { + if o != nil && !IsNil(o.Config) { return true } @@ -70,11 +73,19 @@ func (o *IdentityWithCredentialsPassword) SetConfig(v IdentityWithCredentialsPas } func (o IdentityWithCredentialsPassword) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityWithCredentialsPassword) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Config != nil { + if !IsNil(o.Config) { toSerialize["config"] = o.Config } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityWithCredentialsPassword struct { diff --git a/internal/client-go/model_identity_with_credentials_password_config.go b/internal/client-go/model_identity_with_credentials_password_config.go index 754d59460f83..7dd00ae3ea2a 100644 --- a/internal/client-go/model_identity_with_credentials_password_config.go +++ b/internal/client-go/model_identity_with_credentials_password_config.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityWithCredentialsPasswordConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityWithCredentialsPasswordConfig{} + // IdentityWithCredentialsPasswordConfig Create Identity and Import Password Credentials Configuration type IdentityWithCredentialsPasswordConfig struct { // The hashed password in [PHC format](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities#hashed-passwords) @@ -42,7 +45,7 @@ func NewIdentityWithCredentialsPasswordConfigWithDefaults() *IdentityWithCredent // GetHashedPassword returns the HashedPassword field value if set, zero value otherwise. func (o *IdentityWithCredentialsPasswordConfig) GetHashedPassword() string { - if o == nil || o.HashedPassword == nil { + if o == nil || IsNil(o.HashedPassword) { var ret string return ret } @@ -52,7 +55,7 @@ func (o *IdentityWithCredentialsPasswordConfig) GetHashedPassword() string { // GetHashedPasswordOk returns a tuple with the HashedPassword field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentialsPasswordConfig) GetHashedPasswordOk() (*string, bool) { - if o == nil || o.HashedPassword == nil { + if o == nil || IsNil(o.HashedPassword) { return nil, false } return o.HashedPassword, true @@ -60,7 +63,7 @@ func (o *IdentityWithCredentialsPasswordConfig) GetHashedPasswordOk() (*string, // HasHashedPassword returns a boolean if a field has been set. func (o *IdentityWithCredentialsPasswordConfig) HasHashedPassword() bool { - if o != nil && o.HashedPassword != nil { + if o != nil && !IsNil(o.HashedPassword) { return true } @@ -74,7 +77,7 @@ func (o *IdentityWithCredentialsPasswordConfig) SetHashedPassword(v string) { // GetPassword returns the Password field value if set, zero value otherwise. func (o *IdentityWithCredentialsPasswordConfig) GetPassword() string { - if o == nil || o.Password == nil { + if o == nil || IsNil(o.Password) { var ret string return ret } @@ -84,7 +87,7 @@ func (o *IdentityWithCredentialsPasswordConfig) GetPassword() string { // GetPasswordOk returns a tuple with the Password field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentialsPasswordConfig) GetPasswordOk() (*string, bool) { - if o == nil || o.Password == nil { + if o == nil || IsNil(o.Password) { return nil, false } return o.Password, true @@ -92,7 +95,7 @@ func (o *IdentityWithCredentialsPasswordConfig) GetPasswordOk() (*string, bool) // HasPassword returns a boolean if a field has been set. func (o *IdentityWithCredentialsPasswordConfig) HasPassword() bool { - if o != nil && o.Password != nil { + if o != nil && !IsNil(o.Password) { return true } @@ -105,14 +108,22 @@ func (o *IdentityWithCredentialsPasswordConfig) SetPassword(v string) { } func (o IdentityWithCredentialsPasswordConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityWithCredentialsPasswordConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.HashedPassword != nil { + if !IsNil(o.HashedPassword) { toSerialize["hashed_password"] = o.HashedPassword } - if o.Password != nil { + if !IsNil(o.Password) { toSerialize["password"] = o.Password } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityWithCredentialsPasswordConfig struct { diff --git a/internal/client-go/model_is_alive_200_response.go b/internal/client-go/model_is_alive_200_response.go index cce2dfa5238f..76b0cf00f301 100644 --- a/internal/client-go/model_is_alive_200_response.go +++ b/internal/client-go/model_is_alive_200_response.go @@ -1,26 +1,33 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the IsAlive200Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IsAlive200Response{} + // IsAlive200Response struct for IsAlive200Response type IsAlive200Response struct { // Always \"ok\". Status string `json:"status"` } +type _IsAlive200Response IsAlive200Response + // NewIsAlive200Response instantiates a new IsAlive200Response object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -64,13 +71,56 @@ func (o *IsAlive200Response) SetStatus(v string) { } func (o IsAlive200Response) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["status"] = o.Status + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } return json.Marshal(toSerialize) } +func (o IsAlive200Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["status"] = o.Status + return toSerialize, nil +} + +func (o *IsAlive200Response) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIsAlive200Response := _IsAlive200Response{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIsAlive200Response) + + if err != nil { + return err + } + + *o = IsAlive200Response(varIsAlive200Response) + + return err +} + type NullableIsAlive200Response struct { value *IsAlive200Response isSet bool diff --git a/internal/client-go/model_is_ready_503_response.go b/internal/client-go/model_is_ready_503_response.go index 9b0b6f581a25..b7779f278a98 100644 --- a/internal/client-go/model_is_ready_503_response.go +++ b/internal/client-go/model_is_ready_503_response.go @@ -1,26 +1,33 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the IsReady503Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IsReady503Response{} + // IsReady503Response struct for IsReady503Response type IsReady503Response struct { // Errors contains a list of errors that caused the not ready status. Errors map[string]string `json:"errors"` } +type _IsReady503Response IsReady503Response + // NewIsReady503Response instantiates a new IsReady503Response object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -64,13 +71,56 @@ func (o *IsReady503Response) SetErrors(v map[string]string) { } func (o IsReady503Response) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["errors"] = o.Errors + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } return json.Marshal(toSerialize) } +func (o IsReady503Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["errors"] = o.Errors + return toSerialize, nil +} + +func (o *IsReady503Response) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "errors", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIsReady503Response := _IsReady503Response{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIsReady503Response) + + if err != nil { + return err + } + + *o = IsReady503Response(varIsReady503Response) + + return err +} + type NullableIsReady503Response struct { value *IsReady503Response isSet bool diff --git a/internal/client-go/model_json_patch.go b/internal/client-go/model_json_patch.go index b810d0ef4a74..e2cdb8a4dece 100644 --- a/internal/client-go/model_json_patch.go +++ b/internal/client-go/model_json_patch.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the JsonPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &JsonPatch{} + // JsonPatch A JSONPatch document as defined by RFC 6902 type JsonPatch struct { // This field is used together with operation \"move\" and uses JSON Pointer notation. Learn more [about JSON Pointers](https://datatracker.ietf.org/doc/html/rfc6901#section-5). @@ -27,6 +32,8 @@ type JsonPatch struct { Value interface{} `json:"value,omitempty"` } +type _JsonPatch JsonPatch + // NewJsonPatch instantiates a new JsonPatch object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -48,7 +55,7 @@ func NewJsonPatchWithDefaults() *JsonPatch { // GetFrom returns the From field value if set, zero value otherwise. func (o *JsonPatch) GetFrom() string { - if o == nil || o.From == nil { + if o == nil || IsNil(o.From) { var ret string return ret } @@ -58,7 +65,7 @@ func (o *JsonPatch) GetFrom() string { // GetFromOk returns a tuple with the From field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *JsonPatch) GetFromOk() (*string, bool) { - if o == nil || o.From == nil { + if o == nil || IsNil(o.From) { return nil, false } return o.From, true @@ -66,7 +73,7 @@ func (o *JsonPatch) GetFromOk() (*string, bool) { // HasFrom returns a boolean if a field has been set. func (o *JsonPatch) HasFrom() bool { - if o != nil && o.From != nil { + if o != nil && !IsNil(o.From) { return true } @@ -139,7 +146,7 @@ func (o *JsonPatch) GetValue() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *JsonPatch) GetValueOk() (*interface{}, bool) { - if o == nil || o.Value == nil { + if o == nil || IsNil(o.Value) { return nil, false } return &o.Value, true @@ -147,7 +154,7 @@ func (o *JsonPatch) GetValueOk() (*interface{}, bool) { // HasValue returns a boolean if a field has been set. func (o *JsonPatch) HasValue() bool { - if o != nil && o.Value != nil { + if o != nil && IsNil(o.Value) { return true } @@ -160,20 +167,62 @@ func (o *JsonPatch) SetValue(v interface{}) { } func (o JsonPatch) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o JsonPatch) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.From != nil { + if !IsNil(o.From) { toSerialize["from"] = o.From } - if true { - toSerialize["op"] = o.Op - } - if true { - toSerialize["path"] = o.Path - } + toSerialize["op"] = o.Op + toSerialize["path"] = o.Path if o.Value != nil { toSerialize["value"] = o.Value } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *JsonPatch) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "op", + "path", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varJsonPatch := _JsonPatch{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varJsonPatch) + + if err != nil { + return err + } + + *o = JsonPatch(varJsonPatch) + + return err } type NullableJsonPatch struct { diff --git a/internal/client-go/model_login_flow.go b/internal/client-go/model_login_flow.go index b36abc379568..579ac16e27e9 100644 --- a/internal/client-go/model_login_flow.go +++ b/internal/client-go/model_login_flow.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the LoginFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoginFlow{} + // LoginFlow This object represents a login flow. A login flow is initiated at the \"Initiate Login API / Browser Flow\" endpoint by a client. Once a login flow is completed successfully, a session cookie or session token will be issued. type LoginFlow struct { // The active login method If set contains the login method used. If the flow is new, it is unset. password CredentialsTypePassword oidc CredentialsTypeOIDC totp CredentialsTypeTOTP lookup_secret CredentialsTypeLookup webauthn CredentialsTypeWebAuthn code CredentialsTypeCodeAuth link_recovery CredentialsTypeRecoveryLink CredentialsTypeRecoveryLink is a special credential type linked to the link strategy (recovery flow). It is not used within the credentials object itself. code_recovery CredentialsTypeRecoveryCode @@ -50,6 +55,8 @@ type LoginFlow struct { UpdatedAt *time.Time `json:"updated_at,omitempty"` } +type _LoginFlow LoginFlow + // NewLoginFlow instantiates a new LoginFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -76,7 +83,7 @@ func NewLoginFlowWithDefaults() *LoginFlow { // GetActive returns the Active field value if set, zero value otherwise. func (o *LoginFlow) GetActive() string { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { var ret string return ret } @@ -86,7 +93,7 @@ func (o *LoginFlow) GetActive() string { // GetActiveOk returns a tuple with the Active field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetActiveOk() (*string, bool) { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { return nil, false } return o.Active, true @@ -94,7 +101,7 @@ func (o *LoginFlow) GetActiveOk() (*string, bool) { // HasActive returns a boolean if a field has been set. func (o *LoginFlow) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } @@ -108,7 +115,7 @@ func (o *LoginFlow) SetActive(v string) { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *LoginFlow) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -118,7 +125,7 @@ func (o *LoginFlow) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -126,7 +133,7 @@ func (o *LoginFlow) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *LoginFlow) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -212,7 +219,7 @@ func (o *LoginFlow) SetIssuedAt(v time.Time) { // GetOauth2LoginChallenge returns the Oauth2LoginChallenge field value if set, zero value otherwise. func (o *LoginFlow) GetOauth2LoginChallenge() string { - if o == nil || o.Oauth2LoginChallenge == nil { + if o == nil || IsNil(o.Oauth2LoginChallenge) { var ret string return ret } @@ -222,7 +229,7 @@ func (o *LoginFlow) GetOauth2LoginChallenge() string { // GetOauth2LoginChallengeOk returns a tuple with the Oauth2LoginChallenge field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetOauth2LoginChallengeOk() (*string, bool) { - if o == nil || o.Oauth2LoginChallenge == nil { + if o == nil || IsNil(o.Oauth2LoginChallenge) { return nil, false } return o.Oauth2LoginChallenge, true @@ -230,7 +237,7 @@ func (o *LoginFlow) GetOauth2LoginChallengeOk() (*string, bool) { // HasOauth2LoginChallenge returns a boolean if a field has been set. func (o *LoginFlow) HasOauth2LoginChallenge() bool { - if o != nil && o.Oauth2LoginChallenge != nil { + if o != nil && !IsNil(o.Oauth2LoginChallenge) { return true } @@ -244,7 +251,7 @@ func (o *LoginFlow) SetOauth2LoginChallenge(v string) { // GetOauth2LoginRequest returns the Oauth2LoginRequest field value if set, zero value otherwise. func (o *LoginFlow) GetOauth2LoginRequest() OAuth2LoginRequest { - if o == nil || o.Oauth2LoginRequest == nil { + if o == nil || IsNil(o.Oauth2LoginRequest) { var ret OAuth2LoginRequest return ret } @@ -254,7 +261,7 @@ func (o *LoginFlow) GetOauth2LoginRequest() OAuth2LoginRequest { // GetOauth2LoginRequestOk returns a tuple with the Oauth2LoginRequest field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetOauth2LoginRequestOk() (*OAuth2LoginRequest, bool) { - if o == nil || o.Oauth2LoginRequest == nil { + if o == nil || IsNil(o.Oauth2LoginRequest) { return nil, false } return o.Oauth2LoginRequest, true @@ -262,7 +269,7 @@ func (o *LoginFlow) GetOauth2LoginRequestOk() (*OAuth2LoginRequest, bool) { // HasOauth2LoginRequest returns a boolean if a field has been set. func (o *LoginFlow) HasOauth2LoginRequest() bool { - if o != nil && o.Oauth2LoginRequest != nil { + if o != nil && !IsNil(o.Oauth2LoginRequest) { return true } @@ -276,7 +283,7 @@ func (o *LoginFlow) SetOauth2LoginRequest(v OAuth2LoginRequest) { // GetOrganizationId returns the OrganizationId field value if set, zero value otherwise (both if not set or set to explicit null). func (o *LoginFlow) GetOrganizationId() string { - if o == nil || o.OrganizationId.Get() == nil { + if o == nil || IsNil(o.OrganizationId.Get()) { var ret string return ret } @@ -319,7 +326,7 @@ func (o *LoginFlow) UnsetOrganizationId() { // GetRefresh returns the Refresh field value if set, zero value otherwise. func (o *LoginFlow) GetRefresh() bool { - if o == nil || o.Refresh == nil { + if o == nil || IsNil(o.Refresh) { var ret bool return ret } @@ -329,7 +336,7 @@ func (o *LoginFlow) GetRefresh() bool { // GetRefreshOk returns a tuple with the Refresh field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetRefreshOk() (*bool, bool) { - if o == nil || o.Refresh == nil { + if o == nil || IsNil(o.Refresh) { return nil, false } return o.Refresh, true @@ -337,7 +344,7 @@ func (o *LoginFlow) GetRefreshOk() (*bool, bool) { // HasRefresh returns a boolean if a field has been set. func (o *LoginFlow) HasRefresh() bool { - if o != nil && o.Refresh != nil { + if o != nil && !IsNil(o.Refresh) { return true } @@ -375,7 +382,7 @@ func (o *LoginFlow) SetRequestUrl(v string) { // GetRequestedAal returns the RequestedAal field value if set, zero value otherwise. func (o *LoginFlow) GetRequestedAal() AuthenticatorAssuranceLevel { - if o == nil || o.RequestedAal == nil { + if o == nil || IsNil(o.RequestedAal) { var ret AuthenticatorAssuranceLevel return ret } @@ -385,7 +392,7 @@ func (o *LoginFlow) GetRequestedAal() AuthenticatorAssuranceLevel { // GetRequestedAalOk returns a tuple with the RequestedAal field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetRequestedAalOk() (*AuthenticatorAssuranceLevel, bool) { - if o == nil || o.RequestedAal == nil { + if o == nil || IsNil(o.RequestedAal) { return nil, false } return o.RequestedAal, true @@ -393,7 +400,7 @@ func (o *LoginFlow) GetRequestedAalOk() (*AuthenticatorAssuranceLevel, bool) { // HasRequestedAal returns a boolean if a field has been set. func (o *LoginFlow) HasRequestedAal() bool { - if o != nil && o.RequestedAal != nil { + if o != nil && !IsNil(o.RequestedAal) { return true } @@ -407,7 +414,7 @@ func (o *LoginFlow) SetRequestedAal(v AuthenticatorAssuranceLevel) { // GetReturnTo returns the ReturnTo field value if set, zero value otherwise. func (o *LoginFlow) GetReturnTo() string { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { var ret string return ret } @@ -417,7 +424,7 @@ func (o *LoginFlow) GetReturnTo() string { // GetReturnToOk returns a tuple with the ReturnTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetReturnToOk() (*string, bool) { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { return nil, false } return o.ReturnTo, true @@ -425,7 +432,7 @@ func (o *LoginFlow) GetReturnToOk() (*string, bool) { // HasReturnTo returns a boolean if a field has been set. func (o *LoginFlow) HasReturnTo() bool { - if o != nil && o.ReturnTo != nil { + if o != nil && !IsNil(o.ReturnTo) { return true } @@ -439,7 +446,7 @@ func (o *LoginFlow) SetReturnTo(v string) { // GetSessionTokenExchangeCode returns the SessionTokenExchangeCode field value if set, zero value otherwise. func (o *LoginFlow) GetSessionTokenExchangeCode() string { - if o == nil || o.SessionTokenExchangeCode == nil { + if o == nil || IsNil(o.SessionTokenExchangeCode) { var ret string return ret } @@ -449,7 +456,7 @@ func (o *LoginFlow) GetSessionTokenExchangeCode() string { // GetSessionTokenExchangeCodeOk returns a tuple with the SessionTokenExchangeCode field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetSessionTokenExchangeCodeOk() (*string, bool) { - if o == nil || o.SessionTokenExchangeCode == nil { + if o == nil || IsNil(o.SessionTokenExchangeCode) { return nil, false } return o.SessionTokenExchangeCode, true @@ -457,7 +464,7 @@ func (o *LoginFlow) GetSessionTokenExchangeCodeOk() (*string, bool) { // HasSessionTokenExchangeCode returns a boolean if a field has been set. func (o *LoginFlow) HasSessionTokenExchangeCode() bool { - if o != nil && o.SessionTokenExchangeCode != nil { + if o != nil && !IsNil(o.SessionTokenExchangeCode) { return true } @@ -484,7 +491,7 @@ func (o *LoginFlow) GetState() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *LoginFlow) GetStateOk() (*interface{}, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return &o.State, true @@ -545,7 +552,7 @@ func (o *LoginFlow) SetUi(v UiContainer) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *LoginFlow) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -555,7 +562,7 @@ func (o *LoginFlow) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -563,7 +570,7 @@ func (o *LoginFlow) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *LoginFlow) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -576,59 +583,98 @@ func (o *LoginFlow) SetUpdatedAt(v time.Time) { } func (o LoginFlow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LoginFlow) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if true { - toSerialize["expires_at"] = o.ExpiresAt - } - if true { - toSerialize["id"] = o.Id - } - if true { - toSerialize["issued_at"] = o.IssuedAt - } - if o.Oauth2LoginChallenge != nil { + toSerialize["expires_at"] = o.ExpiresAt + toSerialize["id"] = o.Id + toSerialize["issued_at"] = o.IssuedAt + if !IsNil(o.Oauth2LoginChallenge) { toSerialize["oauth2_login_challenge"] = o.Oauth2LoginChallenge } - if o.Oauth2LoginRequest != nil { + if !IsNil(o.Oauth2LoginRequest) { toSerialize["oauth2_login_request"] = o.Oauth2LoginRequest } if o.OrganizationId.IsSet() { toSerialize["organization_id"] = o.OrganizationId.Get() } - if o.Refresh != nil { + if !IsNil(o.Refresh) { toSerialize["refresh"] = o.Refresh } - if true { - toSerialize["request_url"] = o.RequestUrl - } - if o.RequestedAal != nil { + toSerialize["request_url"] = o.RequestUrl + if !IsNil(o.RequestedAal) { toSerialize["requested_aal"] = o.RequestedAal } - if o.ReturnTo != nil { + if !IsNil(o.ReturnTo) { toSerialize["return_to"] = o.ReturnTo } - if o.SessionTokenExchangeCode != nil { + if !IsNil(o.SessionTokenExchangeCode) { toSerialize["session_token_exchange_code"] = o.SessionTokenExchangeCode } if o.State != nil { toSerialize["state"] = o.State } - if true { - toSerialize["type"] = o.Type + toSerialize["type"] = o.Type + toSerialize["ui"] = o.Ui + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + return toSerialize, nil +} + +func (o *LoginFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "expires_at", + "id", + "issued_at", + "request_url", + "state", + "type", + "ui", } - if true { - toSerialize["ui"] = o.Ui + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if o.UpdatedAt != nil { - toSerialize["updated_at"] = o.UpdatedAt + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varLoginFlow := _LoginFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varLoginFlow) + + if err != nil { + return err + } + + *o = LoginFlow(varLoginFlow) + + return err } type NullableLoginFlow struct { diff --git a/internal/client-go/model_login_flow_state.go b/internal/client-go/model_login_flow_state.go index ce5570b79032..93b41b4708d8 100644 --- a/internal/client-go/model_login_flow_state.go +++ b/internal/client-go/model_login_flow_state.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -26,6 +26,13 @@ const ( LOGINFLOWSTATE_PASSED_CHALLENGE LoginFlowState = "passed_challenge" ) +// All allowed values of LoginFlowState enum +var AllowedLoginFlowStateEnumValues = []LoginFlowState{ + "choose_method", + "sent_email", + "passed_challenge", +} + func (v *LoginFlowState) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -33,7 +40,7 @@ func (v *LoginFlowState) UnmarshalJSON(src []byte) error { return err } enumTypeValue := LoginFlowState(value) - for _, existing := range []LoginFlowState{"choose_method", "sent_email", "passed_challenge"} { + for _, existing := range AllowedLoginFlowStateEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -43,6 +50,27 @@ func (v *LoginFlowState) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid LoginFlowState", value) } +// NewLoginFlowStateFromValue returns a pointer to a valid LoginFlowState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLoginFlowStateFromValue(v string) (*LoginFlowState, error) { + ev := LoginFlowState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LoginFlowState: valid values are %v", v, AllowedLoginFlowStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LoginFlowState) IsValid() bool { + for _, existing := range AllowedLoginFlowStateEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to loginFlowState value func (v LoginFlowState) Ptr() *LoginFlowState { return &v diff --git a/internal/client-go/model_logout_flow.go b/internal/client-go/model_logout_flow.go index 63c339b4febd..14ea2b117a38 100644 --- a/internal/client-go/model_logout_flow.go +++ b/internal/client-go/model_logout_flow.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the LogoutFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LogoutFlow{} + // LogoutFlow Logout Flow type LogoutFlow struct { // LogoutToken can be used to perform logout using AJAX. @@ -23,6 +28,8 @@ type LogoutFlow struct { LogoutUrl string `json:"logout_url"` } +type _LogoutFlow LogoutFlow + // NewLogoutFlow instantiates a new LogoutFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -91,14 +98,56 @@ func (o *LogoutFlow) SetLogoutUrl(v string) { } func (o LogoutFlow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LogoutFlow) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["logout_token"] = o.LogoutToken + toSerialize["logout_token"] = o.LogoutToken + toSerialize["logout_url"] = o.LogoutUrl + return toSerialize, nil +} + +func (o *LogoutFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "logout_token", + "logout_url", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["logout_url"] = o.LogoutUrl + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varLogoutFlow := _LogoutFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varLogoutFlow) + + if err != nil { + return err + } + + *o = LogoutFlow(varLogoutFlow) + + return err } type NullableLogoutFlow struct { diff --git a/internal/client-go/model_message.go b/internal/client-go/model_message.go index 405575779c78..011a69dce172 100644 --- a/internal/client-go/model_message.go +++ b/internal/client-go/model_message.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the Message type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Message{} + // Message struct for Message type Message struct { Body string `json:"body"` @@ -36,6 +41,8 @@ type Message struct { UpdatedAt time.Time `json:"updated_at"` } +type _Message Message + // NewMessage instantiates a new Message object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -89,7 +96,7 @@ func (o *Message) SetBody(v string) { // GetChannel returns the Channel field value if set, zero value otherwise. func (o *Message) GetChannel() string { - if o == nil || o.Channel == nil { + if o == nil || IsNil(o.Channel) { var ret string return ret } @@ -99,7 +106,7 @@ func (o *Message) GetChannel() string { // GetChannelOk returns a tuple with the Channel field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Message) GetChannelOk() (*string, bool) { - if o == nil || o.Channel == nil { + if o == nil || IsNil(o.Channel) { return nil, false } return o.Channel, true @@ -107,7 +114,7 @@ func (o *Message) GetChannelOk() (*string, bool) { // HasChannel returns a boolean if a field has been set. func (o *Message) HasChannel() bool { - if o != nil && o.Channel != nil { + if o != nil && !IsNil(o.Channel) { return true } @@ -145,7 +152,7 @@ func (o *Message) SetCreatedAt(v time.Time) { // GetDispatches returns the Dispatches field value if set, zero value otherwise. func (o *Message) GetDispatches() []MessageDispatch { - if o == nil || o.Dispatches == nil { + if o == nil || IsNil(o.Dispatches) { var ret []MessageDispatch return ret } @@ -155,7 +162,7 @@ func (o *Message) GetDispatches() []MessageDispatch { // GetDispatchesOk returns a tuple with the Dispatches field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Message) GetDispatchesOk() ([]MessageDispatch, bool) { - if o == nil || o.Dispatches == nil { + if o == nil || IsNil(o.Dispatches) { return nil, false } return o.Dispatches, true @@ -163,7 +170,7 @@ func (o *Message) GetDispatchesOk() ([]MessageDispatch, bool) { // HasDispatches returns a boolean if a field has been set. func (o *Message) HasDispatches() bool { - if o != nil && o.Dispatches != nil { + if o != nil && !IsNil(o.Dispatches) { return true } @@ -368,44 +375,78 @@ func (o *Message) SetUpdatedAt(v time.Time) { } func (o Message) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["body"] = o.Body + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Channel != nil { + return json.Marshal(toSerialize) +} + +func (o Message) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["body"] = o.Body + if !IsNil(o.Channel) { toSerialize["channel"] = o.Channel } - if true { - toSerialize["created_at"] = o.CreatedAt - } - if o.Dispatches != nil { + toSerialize["created_at"] = o.CreatedAt + if !IsNil(o.Dispatches) { toSerialize["dispatches"] = o.Dispatches } - if true { - toSerialize["id"] = o.Id - } - if true { - toSerialize["recipient"] = o.Recipient - } - if true { - toSerialize["send_count"] = o.SendCount - } - if true { - toSerialize["status"] = o.Status - } - if true { - toSerialize["subject"] = o.Subject + toSerialize["id"] = o.Id + toSerialize["recipient"] = o.Recipient + toSerialize["send_count"] = o.SendCount + toSerialize["status"] = o.Status + toSerialize["subject"] = o.Subject + toSerialize["template_type"] = o.TemplateType + toSerialize["type"] = o.Type + toSerialize["updated_at"] = o.UpdatedAt + return toSerialize, nil +} + +func (o *Message) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "body", + "created_at", + "id", + "recipient", + "send_count", + "status", + "subject", + "template_type", + "type", + "updated_at", } - if true { - toSerialize["template_type"] = o.TemplateType + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["type"] = o.Type + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["updated_at"] = o.UpdatedAt + + varMessage := _Message{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varMessage) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = Message(varMessage) + + return err } type NullableMessage struct { diff --git a/internal/client-go/model_message_dispatch.go b/internal/client-go/model_message_dispatch.go index d5ad3a2b670b..717475a4828c 100644 --- a/internal/client-go/model_message_dispatch.go +++ b/internal/client-go/model_message_dispatch.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the MessageDispatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MessageDispatch{} + // MessageDispatch MessageDispatch represents an attempt of sending a courier message It contains the status of the attempt (failed or successful) and the error if any occured type MessageDispatch struct { // CreatedAt is a helper struct field for gobuffalo.pop. @@ -31,6 +36,8 @@ type MessageDispatch struct { UpdatedAt time.Time `json:"updated_at"` } +type _MessageDispatch MessageDispatch + // NewMessageDispatch instantiates a new MessageDispatch object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -79,7 +86,7 @@ func (o *MessageDispatch) SetCreatedAt(v time.Time) { // GetError returns the Error field value if set, zero value otherwise. func (o *MessageDispatch) GetError() map[string]interface{} { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret map[string]interface{} return ret } @@ -89,15 +96,15 @@ func (o *MessageDispatch) GetError() map[string]interface{} { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *MessageDispatch) GetErrorOk() (map[string]interface{}, bool) { - if o == nil || o.Error == nil { - return nil, false + if o == nil || IsNil(o.Error) { + return map[string]interface{}{}, false } return o.Error, true } // HasError returns a boolean if a field has been set. func (o *MessageDispatch) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -206,26 +213,65 @@ func (o *MessageDispatch) SetUpdatedAt(v time.Time) { } func (o MessageDispatch) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["created_at"] = o.CreatedAt + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Error != nil { + return json.Marshal(toSerialize) +} + +func (o MessageDispatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["created_at"] = o.CreatedAt + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if true { - toSerialize["id"] = o.Id + toSerialize["id"] = o.Id + toSerialize["message_id"] = o.MessageId + toSerialize["status"] = o.Status + toSerialize["updated_at"] = o.UpdatedAt + return toSerialize, nil +} + +func (o *MessageDispatch) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "created_at", + "id", + "message_id", + "status", + "updated_at", } - if true { - toSerialize["message_id"] = o.MessageId + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["status"] = o.Status + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["updated_at"] = o.UpdatedAt + + varMessageDispatch := _MessageDispatch{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varMessageDispatch) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = MessageDispatch(varMessageDispatch) + + return err } type NullableMessageDispatch struct { diff --git a/internal/client-go/model_needs_privileged_session_error.go b/internal/client-go/model_needs_privileged_session_error.go index ea91c4ba2331..6935f89fdc49 100644 --- a/internal/client-go/model_needs_privileged_session_error.go +++ b/internal/client-go/model_needs_privileged_session_error.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the NeedsPrivilegedSessionError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NeedsPrivilegedSessionError{} + // NeedsPrivilegedSessionError struct for NeedsPrivilegedSessionError type NeedsPrivilegedSessionError struct { Error *GenericError `json:"error,omitempty"` @@ -22,6 +27,8 @@ type NeedsPrivilegedSessionError struct { RedirectBrowserTo string `json:"redirect_browser_to"` } +type _NeedsPrivilegedSessionError NeedsPrivilegedSessionError + // NewNeedsPrivilegedSessionError instantiates a new NeedsPrivilegedSessionError object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -42,7 +49,7 @@ func NewNeedsPrivilegedSessionErrorWithDefaults() *NeedsPrivilegedSessionError { // GetError returns the Error field value if set, zero value otherwise. func (o *NeedsPrivilegedSessionError) GetError() GenericError { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret GenericError return ret } @@ -52,7 +59,7 @@ func (o *NeedsPrivilegedSessionError) GetError() GenericError { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *NeedsPrivilegedSessionError) GetErrorOk() (*GenericError, bool) { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { return nil, false } return o.Error, true @@ -60,7 +67,7 @@ func (o *NeedsPrivilegedSessionError) GetErrorOk() (*GenericError, bool) { // HasError returns a boolean if a field has been set. func (o *NeedsPrivilegedSessionError) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -97,14 +104,57 @@ func (o *NeedsPrivilegedSessionError) SetRedirectBrowserTo(v string) { } func (o NeedsPrivilegedSessionError) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NeedsPrivilegedSessionError) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Error != nil { + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if true { - toSerialize["redirect_browser_to"] = o.RedirectBrowserTo + toSerialize["redirect_browser_to"] = o.RedirectBrowserTo + return toSerialize, nil +} + +func (o *NeedsPrivilegedSessionError) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "redirect_browser_to", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varNeedsPrivilegedSessionError := _NeedsPrivilegedSessionError{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varNeedsPrivilegedSessionError) + + if err != nil { + return err + } + + *o = NeedsPrivilegedSessionError(varNeedsPrivilegedSessionError) + + return err } type NullableNeedsPrivilegedSessionError struct { diff --git a/internal/client-go/model_o_auth2_client.go b/internal/client-go/model_o_auth2_client.go index eab35e350486..f2267ef948df 100644 --- a/internal/client-go/model_o_auth2_client.go +++ b/internal/client-go/model_o_auth2_client.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -16,6 +16,9 @@ import ( "time" ) +// checks if the OAuth2Client type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OAuth2Client{} + // OAuth2Client struct for OAuth2Client type OAuth2Client struct { AdditionalPropertiesField map[string]interface{} `json:"AdditionalProperties,omitempty"` @@ -125,7 +128,7 @@ func NewOAuth2ClientWithDefaults() *OAuth2Client { // GetAdditionalPropertiesField returns the AdditionalPropertiesField field value if set, zero value otherwise. func (o *OAuth2Client) GetAdditionalPropertiesField() map[string]interface{} { - if o == nil || o.AdditionalPropertiesField == nil { + if o == nil || IsNil(o.AdditionalPropertiesField) { var ret map[string]interface{} return ret } @@ -135,15 +138,15 @@ func (o *OAuth2Client) GetAdditionalPropertiesField() map[string]interface{} { // GetAdditionalPropertiesFieldOk returns a tuple with the AdditionalPropertiesField field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAdditionalPropertiesFieldOk() (map[string]interface{}, bool) { - if o == nil || o.AdditionalPropertiesField == nil { - return nil, false + if o == nil || IsNil(o.AdditionalPropertiesField) { + return map[string]interface{}{}, false } return o.AdditionalPropertiesField, true } // HasAdditionalPropertiesField returns a boolean if a field has been set. func (o *OAuth2Client) HasAdditionalPropertiesField() bool { - if o != nil && o.AdditionalPropertiesField != nil { + if o != nil && !IsNil(o.AdditionalPropertiesField) { return true } @@ -157,7 +160,7 @@ func (o *OAuth2Client) SetAdditionalPropertiesField(v map[string]interface{}) { // GetAccessTokenStrategy returns the AccessTokenStrategy field value if set, zero value otherwise. func (o *OAuth2Client) GetAccessTokenStrategy() string { - if o == nil || o.AccessTokenStrategy == nil { + if o == nil || IsNil(o.AccessTokenStrategy) { var ret string return ret } @@ -167,7 +170,7 @@ func (o *OAuth2Client) GetAccessTokenStrategy() string { // GetAccessTokenStrategyOk returns a tuple with the AccessTokenStrategy field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAccessTokenStrategyOk() (*string, bool) { - if o == nil || o.AccessTokenStrategy == nil { + if o == nil || IsNil(o.AccessTokenStrategy) { return nil, false } return o.AccessTokenStrategy, true @@ -175,7 +178,7 @@ func (o *OAuth2Client) GetAccessTokenStrategyOk() (*string, bool) { // HasAccessTokenStrategy returns a boolean if a field has been set. func (o *OAuth2Client) HasAccessTokenStrategy() bool { - if o != nil && o.AccessTokenStrategy != nil { + if o != nil && !IsNil(o.AccessTokenStrategy) { return true } @@ -189,7 +192,7 @@ func (o *OAuth2Client) SetAccessTokenStrategy(v string) { // GetAllowedCorsOrigins returns the AllowedCorsOrigins field value if set, zero value otherwise. func (o *OAuth2Client) GetAllowedCorsOrigins() []string { - if o == nil || o.AllowedCorsOrigins == nil { + if o == nil || IsNil(o.AllowedCorsOrigins) { var ret []string return ret } @@ -199,7 +202,7 @@ func (o *OAuth2Client) GetAllowedCorsOrigins() []string { // GetAllowedCorsOriginsOk returns a tuple with the AllowedCorsOrigins field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAllowedCorsOriginsOk() ([]string, bool) { - if o == nil || o.AllowedCorsOrigins == nil { + if o == nil || IsNil(o.AllowedCorsOrigins) { return nil, false } return o.AllowedCorsOrigins, true @@ -207,7 +210,7 @@ func (o *OAuth2Client) GetAllowedCorsOriginsOk() ([]string, bool) { // HasAllowedCorsOrigins returns a boolean if a field has been set. func (o *OAuth2Client) HasAllowedCorsOrigins() bool { - if o != nil && o.AllowedCorsOrigins != nil { + if o != nil && !IsNil(o.AllowedCorsOrigins) { return true } @@ -221,7 +224,7 @@ func (o *OAuth2Client) SetAllowedCorsOrigins(v []string) { // GetAudience returns the Audience field value if set, zero value otherwise. func (o *OAuth2Client) GetAudience() []string { - if o == nil || o.Audience == nil { + if o == nil || IsNil(o.Audience) { var ret []string return ret } @@ -231,7 +234,7 @@ func (o *OAuth2Client) GetAudience() []string { // GetAudienceOk returns a tuple with the Audience field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAudienceOk() ([]string, bool) { - if o == nil || o.Audience == nil { + if o == nil || IsNil(o.Audience) { return nil, false } return o.Audience, true @@ -239,7 +242,7 @@ func (o *OAuth2Client) GetAudienceOk() ([]string, bool) { // HasAudience returns a boolean if a field has been set. func (o *OAuth2Client) HasAudience() bool { - if o != nil && o.Audience != nil { + if o != nil && !IsNil(o.Audience) { return true } @@ -253,7 +256,7 @@ func (o *OAuth2Client) SetAudience(v []string) { // GetAuthorizationCodeGrantAccessTokenLifespan returns the AuthorizationCodeGrantAccessTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetAuthorizationCodeGrantAccessTokenLifespan() string { - if o == nil || o.AuthorizationCodeGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.AuthorizationCodeGrantAccessTokenLifespan) { var ret string return ret } @@ -263,7 +266,7 @@ func (o *OAuth2Client) GetAuthorizationCodeGrantAccessTokenLifespan() string { // GetAuthorizationCodeGrantAccessTokenLifespanOk returns a tuple with the AuthorizationCodeGrantAccessTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAuthorizationCodeGrantAccessTokenLifespanOk() (*string, bool) { - if o == nil || o.AuthorizationCodeGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.AuthorizationCodeGrantAccessTokenLifespan) { return nil, false } return o.AuthorizationCodeGrantAccessTokenLifespan, true @@ -271,7 +274,7 @@ func (o *OAuth2Client) GetAuthorizationCodeGrantAccessTokenLifespanOk() (*string // HasAuthorizationCodeGrantAccessTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasAuthorizationCodeGrantAccessTokenLifespan() bool { - if o != nil && o.AuthorizationCodeGrantAccessTokenLifespan != nil { + if o != nil && !IsNil(o.AuthorizationCodeGrantAccessTokenLifespan) { return true } @@ -285,7 +288,7 @@ func (o *OAuth2Client) SetAuthorizationCodeGrantAccessTokenLifespan(v string) { // GetAuthorizationCodeGrantIdTokenLifespan returns the AuthorizationCodeGrantIdTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetAuthorizationCodeGrantIdTokenLifespan() string { - if o == nil || o.AuthorizationCodeGrantIdTokenLifespan == nil { + if o == nil || IsNil(o.AuthorizationCodeGrantIdTokenLifespan) { var ret string return ret } @@ -295,7 +298,7 @@ func (o *OAuth2Client) GetAuthorizationCodeGrantIdTokenLifespan() string { // GetAuthorizationCodeGrantIdTokenLifespanOk returns a tuple with the AuthorizationCodeGrantIdTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAuthorizationCodeGrantIdTokenLifespanOk() (*string, bool) { - if o == nil || o.AuthorizationCodeGrantIdTokenLifespan == nil { + if o == nil || IsNil(o.AuthorizationCodeGrantIdTokenLifespan) { return nil, false } return o.AuthorizationCodeGrantIdTokenLifespan, true @@ -303,7 +306,7 @@ func (o *OAuth2Client) GetAuthorizationCodeGrantIdTokenLifespanOk() (*string, bo // HasAuthorizationCodeGrantIdTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasAuthorizationCodeGrantIdTokenLifespan() bool { - if o != nil && o.AuthorizationCodeGrantIdTokenLifespan != nil { + if o != nil && !IsNil(o.AuthorizationCodeGrantIdTokenLifespan) { return true } @@ -317,7 +320,7 @@ func (o *OAuth2Client) SetAuthorizationCodeGrantIdTokenLifespan(v string) { // GetAuthorizationCodeGrantRefreshTokenLifespan returns the AuthorizationCodeGrantRefreshTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetAuthorizationCodeGrantRefreshTokenLifespan() string { - if o == nil || o.AuthorizationCodeGrantRefreshTokenLifespan == nil { + if o == nil || IsNil(o.AuthorizationCodeGrantRefreshTokenLifespan) { var ret string return ret } @@ -327,7 +330,7 @@ func (o *OAuth2Client) GetAuthorizationCodeGrantRefreshTokenLifespan() string { // GetAuthorizationCodeGrantRefreshTokenLifespanOk returns a tuple with the AuthorizationCodeGrantRefreshTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAuthorizationCodeGrantRefreshTokenLifespanOk() (*string, bool) { - if o == nil || o.AuthorizationCodeGrantRefreshTokenLifespan == nil { + if o == nil || IsNil(o.AuthorizationCodeGrantRefreshTokenLifespan) { return nil, false } return o.AuthorizationCodeGrantRefreshTokenLifespan, true @@ -335,7 +338,7 @@ func (o *OAuth2Client) GetAuthorizationCodeGrantRefreshTokenLifespanOk() (*strin // HasAuthorizationCodeGrantRefreshTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasAuthorizationCodeGrantRefreshTokenLifespan() bool { - if o != nil && o.AuthorizationCodeGrantRefreshTokenLifespan != nil { + if o != nil && !IsNil(o.AuthorizationCodeGrantRefreshTokenLifespan) { return true } @@ -349,7 +352,7 @@ func (o *OAuth2Client) SetAuthorizationCodeGrantRefreshTokenLifespan(v string) { // GetBackchannelLogoutSessionRequired returns the BackchannelLogoutSessionRequired field value if set, zero value otherwise. func (o *OAuth2Client) GetBackchannelLogoutSessionRequired() bool { - if o == nil || o.BackchannelLogoutSessionRequired == nil { + if o == nil || IsNil(o.BackchannelLogoutSessionRequired) { var ret bool return ret } @@ -359,7 +362,7 @@ func (o *OAuth2Client) GetBackchannelLogoutSessionRequired() bool { // GetBackchannelLogoutSessionRequiredOk returns a tuple with the BackchannelLogoutSessionRequired field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetBackchannelLogoutSessionRequiredOk() (*bool, bool) { - if o == nil || o.BackchannelLogoutSessionRequired == nil { + if o == nil || IsNil(o.BackchannelLogoutSessionRequired) { return nil, false } return o.BackchannelLogoutSessionRequired, true @@ -367,7 +370,7 @@ func (o *OAuth2Client) GetBackchannelLogoutSessionRequiredOk() (*bool, bool) { // HasBackchannelLogoutSessionRequired returns a boolean if a field has been set. func (o *OAuth2Client) HasBackchannelLogoutSessionRequired() bool { - if o != nil && o.BackchannelLogoutSessionRequired != nil { + if o != nil && !IsNil(o.BackchannelLogoutSessionRequired) { return true } @@ -381,7 +384,7 @@ func (o *OAuth2Client) SetBackchannelLogoutSessionRequired(v bool) { // GetBackchannelLogoutUri returns the BackchannelLogoutUri field value if set, zero value otherwise. func (o *OAuth2Client) GetBackchannelLogoutUri() string { - if o == nil || o.BackchannelLogoutUri == nil { + if o == nil || IsNil(o.BackchannelLogoutUri) { var ret string return ret } @@ -391,7 +394,7 @@ func (o *OAuth2Client) GetBackchannelLogoutUri() string { // GetBackchannelLogoutUriOk returns a tuple with the BackchannelLogoutUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetBackchannelLogoutUriOk() (*string, bool) { - if o == nil || o.BackchannelLogoutUri == nil { + if o == nil || IsNil(o.BackchannelLogoutUri) { return nil, false } return o.BackchannelLogoutUri, true @@ -399,7 +402,7 @@ func (o *OAuth2Client) GetBackchannelLogoutUriOk() (*string, bool) { // HasBackchannelLogoutUri returns a boolean if a field has been set. func (o *OAuth2Client) HasBackchannelLogoutUri() bool { - if o != nil && o.BackchannelLogoutUri != nil { + if o != nil && !IsNil(o.BackchannelLogoutUri) { return true } @@ -413,7 +416,7 @@ func (o *OAuth2Client) SetBackchannelLogoutUri(v string) { // GetClientCredentialsGrantAccessTokenLifespan returns the ClientCredentialsGrantAccessTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetClientCredentialsGrantAccessTokenLifespan() string { - if o == nil || o.ClientCredentialsGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.ClientCredentialsGrantAccessTokenLifespan) { var ret string return ret } @@ -423,7 +426,7 @@ func (o *OAuth2Client) GetClientCredentialsGrantAccessTokenLifespan() string { // GetClientCredentialsGrantAccessTokenLifespanOk returns a tuple with the ClientCredentialsGrantAccessTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetClientCredentialsGrantAccessTokenLifespanOk() (*string, bool) { - if o == nil || o.ClientCredentialsGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.ClientCredentialsGrantAccessTokenLifespan) { return nil, false } return o.ClientCredentialsGrantAccessTokenLifespan, true @@ -431,7 +434,7 @@ func (o *OAuth2Client) GetClientCredentialsGrantAccessTokenLifespanOk() (*string // HasClientCredentialsGrantAccessTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasClientCredentialsGrantAccessTokenLifespan() bool { - if o != nil && o.ClientCredentialsGrantAccessTokenLifespan != nil { + if o != nil && !IsNil(o.ClientCredentialsGrantAccessTokenLifespan) { return true } @@ -445,7 +448,7 @@ func (o *OAuth2Client) SetClientCredentialsGrantAccessTokenLifespan(v string) { // GetClientId returns the ClientId field value if set, zero value otherwise. func (o *OAuth2Client) GetClientId() string { - if o == nil || o.ClientId == nil { + if o == nil || IsNil(o.ClientId) { var ret string return ret } @@ -455,7 +458,7 @@ func (o *OAuth2Client) GetClientId() string { // GetClientIdOk returns a tuple with the ClientId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetClientIdOk() (*string, bool) { - if o == nil || o.ClientId == nil { + if o == nil || IsNil(o.ClientId) { return nil, false } return o.ClientId, true @@ -463,7 +466,7 @@ func (o *OAuth2Client) GetClientIdOk() (*string, bool) { // HasClientId returns a boolean if a field has been set. func (o *OAuth2Client) HasClientId() bool { - if o != nil && o.ClientId != nil { + if o != nil && !IsNil(o.ClientId) { return true } @@ -477,7 +480,7 @@ func (o *OAuth2Client) SetClientId(v string) { // GetClientName returns the ClientName field value if set, zero value otherwise. func (o *OAuth2Client) GetClientName() string { - if o == nil || o.ClientName == nil { + if o == nil || IsNil(o.ClientName) { var ret string return ret } @@ -487,7 +490,7 @@ func (o *OAuth2Client) GetClientName() string { // GetClientNameOk returns a tuple with the ClientName field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetClientNameOk() (*string, bool) { - if o == nil || o.ClientName == nil { + if o == nil || IsNil(o.ClientName) { return nil, false } return o.ClientName, true @@ -495,7 +498,7 @@ func (o *OAuth2Client) GetClientNameOk() (*string, bool) { // HasClientName returns a boolean if a field has been set. func (o *OAuth2Client) HasClientName() bool { - if o != nil && o.ClientName != nil { + if o != nil && !IsNil(o.ClientName) { return true } @@ -509,7 +512,7 @@ func (o *OAuth2Client) SetClientName(v string) { // GetClientSecret returns the ClientSecret field value if set, zero value otherwise. func (o *OAuth2Client) GetClientSecret() string { - if o == nil || o.ClientSecret == nil { + if o == nil || IsNil(o.ClientSecret) { var ret string return ret } @@ -519,7 +522,7 @@ func (o *OAuth2Client) GetClientSecret() string { // GetClientSecretOk returns a tuple with the ClientSecret field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetClientSecretOk() (*string, bool) { - if o == nil || o.ClientSecret == nil { + if o == nil || IsNil(o.ClientSecret) { return nil, false } return o.ClientSecret, true @@ -527,7 +530,7 @@ func (o *OAuth2Client) GetClientSecretOk() (*string, bool) { // HasClientSecret returns a boolean if a field has been set. func (o *OAuth2Client) HasClientSecret() bool { - if o != nil && o.ClientSecret != nil { + if o != nil && !IsNil(o.ClientSecret) { return true } @@ -541,7 +544,7 @@ func (o *OAuth2Client) SetClientSecret(v string) { // GetClientSecretExpiresAt returns the ClientSecretExpiresAt field value if set, zero value otherwise. func (o *OAuth2Client) GetClientSecretExpiresAt() int64 { - if o == nil || o.ClientSecretExpiresAt == nil { + if o == nil || IsNil(o.ClientSecretExpiresAt) { var ret int64 return ret } @@ -551,7 +554,7 @@ func (o *OAuth2Client) GetClientSecretExpiresAt() int64 { // GetClientSecretExpiresAtOk returns a tuple with the ClientSecretExpiresAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetClientSecretExpiresAtOk() (*int64, bool) { - if o == nil || o.ClientSecretExpiresAt == nil { + if o == nil || IsNil(o.ClientSecretExpiresAt) { return nil, false } return o.ClientSecretExpiresAt, true @@ -559,7 +562,7 @@ func (o *OAuth2Client) GetClientSecretExpiresAtOk() (*int64, bool) { // HasClientSecretExpiresAt returns a boolean if a field has been set. func (o *OAuth2Client) HasClientSecretExpiresAt() bool { - if o != nil && o.ClientSecretExpiresAt != nil { + if o != nil && !IsNil(o.ClientSecretExpiresAt) { return true } @@ -573,7 +576,7 @@ func (o *OAuth2Client) SetClientSecretExpiresAt(v int64) { // GetClientUri returns the ClientUri field value if set, zero value otherwise. func (o *OAuth2Client) GetClientUri() string { - if o == nil || o.ClientUri == nil { + if o == nil || IsNil(o.ClientUri) { var ret string return ret } @@ -583,7 +586,7 @@ func (o *OAuth2Client) GetClientUri() string { // GetClientUriOk returns a tuple with the ClientUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetClientUriOk() (*string, bool) { - if o == nil || o.ClientUri == nil { + if o == nil || IsNil(o.ClientUri) { return nil, false } return o.ClientUri, true @@ -591,7 +594,7 @@ func (o *OAuth2Client) GetClientUriOk() (*string, bool) { // HasClientUri returns a boolean if a field has been set. func (o *OAuth2Client) HasClientUri() bool { - if o != nil && o.ClientUri != nil { + if o != nil && !IsNil(o.ClientUri) { return true } @@ -605,7 +608,7 @@ func (o *OAuth2Client) SetClientUri(v string) { // GetContacts returns the Contacts field value if set, zero value otherwise. func (o *OAuth2Client) GetContacts() []string { - if o == nil || o.Contacts == nil { + if o == nil || IsNil(o.Contacts) { var ret []string return ret } @@ -615,7 +618,7 @@ func (o *OAuth2Client) GetContacts() []string { // GetContactsOk returns a tuple with the Contacts field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetContactsOk() ([]string, bool) { - if o == nil || o.Contacts == nil { + if o == nil || IsNil(o.Contacts) { return nil, false } return o.Contacts, true @@ -623,7 +626,7 @@ func (o *OAuth2Client) GetContactsOk() ([]string, bool) { // HasContacts returns a boolean if a field has been set. func (o *OAuth2Client) HasContacts() bool { - if o != nil && o.Contacts != nil { + if o != nil && !IsNil(o.Contacts) { return true } @@ -637,7 +640,7 @@ func (o *OAuth2Client) SetContacts(v []string) { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *OAuth2Client) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -647,7 +650,7 @@ func (o *OAuth2Client) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -655,7 +658,7 @@ func (o *OAuth2Client) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *OAuth2Client) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -669,7 +672,7 @@ func (o *OAuth2Client) SetCreatedAt(v time.Time) { // GetFrontchannelLogoutSessionRequired returns the FrontchannelLogoutSessionRequired field value if set, zero value otherwise. func (o *OAuth2Client) GetFrontchannelLogoutSessionRequired() bool { - if o == nil || o.FrontchannelLogoutSessionRequired == nil { + if o == nil || IsNil(o.FrontchannelLogoutSessionRequired) { var ret bool return ret } @@ -679,7 +682,7 @@ func (o *OAuth2Client) GetFrontchannelLogoutSessionRequired() bool { // GetFrontchannelLogoutSessionRequiredOk returns a tuple with the FrontchannelLogoutSessionRequired field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetFrontchannelLogoutSessionRequiredOk() (*bool, bool) { - if o == nil || o.FrontchannelLogoutSessionRequired == nil { + if o == nil || IsNil(o.FrontchannelLogoutSessionRequired) { return nil, false } return o.FrontchannelLogoutSessionRequired, true @@ -687,7 +690,7 @@ func (o *OAuth2Client) GetFrontchannelLogoutSessionRequiredOk() (*bool, bool) { // HasFrontchannelLogoutSessionRequired returns a boolean if a field has been set. func (o *OAuth2Client) HasFrontchannelLogoutSessionRequired() bool { - if o != nil && o.FrontchannelLogoutSessionRequired != nil { + if o != nil && !IsNil(o.FrontchannelLogoutSessionRequired) { return true } @@ -701,7 +704,7 @@ func (o *OAuth2Client) SetFrontchannelLogoutSessionRequired(v bool) { // GetFrontchannelLogoutUri returns the FrontchannelLogoutUri field value if set, zero value otherwise. func (o *OAuth2Client) GetFrontchannelLogoutUri() string { - if o == nil || o.FrontchannelLogoutUri == nil { + if o == nil || IsNil(o.FrontchannelLogoutUri) { var ret string return ret } @@ -711,7 +714,7 @@ func (o *OAuth2Client) GetFrontchannelLogoutUri() string { // GetFrontchannelLogoutUriOk returns a tuple with the FrontchannelLogoutUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetFrontchannelLogoutUriOk() (*string, bool) { - if o == nil || o.FrontchannelLogoutUri == nil { + if o == nil || IsNil(o.FrontchannelLogoutUri) { return nil, false } return o.FrontchannelLogoutUri, true @@ -719,7 +722,7 @@ func (o *OAuth2Client) GetFrontchannelLogoutUriOk() (*string, bool) { // HasFrontchannelLogoutUri returns a boolean if a field has been set. func (o *OAuth2Client) HasFrontchannelLogoutUri() bool { - if o != nil && o.FrontchannelLogoutUri != nil { + if o != nil && !IsNil(o.FrontchannelLogoutUri) { return true } @@ -733,7 +736,7 @@ func (o *OAuth2Client) SetFrontchannelLogoutUri(v string) { // GetGrantTypes returns the GrantTypes field value if set, zero value otherwise. func (o *OAuth2Client) GetGrantTypes() []string { - if o == nil || o.GrantTypes == nil { + if o == nil || IsNil(o.GrantTypes) { var ret []string return ret } @@ -743,7 +746,7 @@ func (o *OAuth2Client) GetGrantTypes() []string { // GetGrantTypesOk returns a tuple with the GrantTypes field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetGrantTypesOk() ([]string, bool) { - if o == nil || o.GrantTypes == nil { + if o == nil || IsNil(o.GrantTypes) { return nil, false } return o.GrantTypes, true @@ -751,7 +754,7 @@ func (o *OAuth2Client) GetGrantTypesOk() ([]string, bool) { // HasGrantTypes returns a boolean if a field has been set. func (o *OAuth2Client) HasGrantTypes() bool { - if o != nil && o.GrantTypes != nil { + if o != nil && !IsNil(o.GrantTypes) { return true } @@ -765,7 +768,7 @@ func (o *OAuth2Client) SetGrantTypes(v []string) { // GetImplicitGrantAccessTokenLifespan returns the ImplicitGrantAccessTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetImplicitGrantAccessTokenLifespan() string { - if o == nil || o.ImplicitGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.ImplicitGrantAccessTokenLifespan) { var ret string return ret } @@ -775,7 +778,7 @@ func (o *OAuth2Client) GetImplicitGrantAccessTokenLifespan() string { // GetImplicitGrantAccessTokenLifespanOk returns a tuple with the ImplicitGrantAccessTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetImplicitGrantAccessTokenLifespanOk() (*string, bool) { - if o == nil || o.ImplicitGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.ImplicitGrantAccessTokenLifespan) { return nil, false } return o.ImplicitGrantAccessTokenLifespan, true @@ -783,7 +786,7 @@ func (o *OAuth2Client) GetImplicitGrantAccessTokenLifespanOk() (*string, bool) { // HasImplicitGrantAccessTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasImplicitGrantAccessTokenLifespan() bool { - if o != nil && o.ImplicitGrantAccessTokenLifespan != nil { + if o != nil && !IsNil(o.ImplicitGrantAccessTokenLifespan) { return true } @@ -797,7 +800,7 @@ func (o *OAuth2Client) SetImplicitGrantAccessTokenLifespan(v string) { // GetImplicitGrantIdTokenLifespan returns the ImplicitGrantIdTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetImplicitGrantIdTokenLifespan() string { - if o == nil || o.ImplicitGrantIdTokenLifespan == nil { + if o == nil || IsNil(o.ImplicitGrantIdTokenLifespan) { var ret string return ret } @@ -807,7 +810,7 @@ func (o *OAuth2Client) GetImplicitGrantIdTokenLifespan() string { // GetImplicitGrantIdTokenLifespanOk returns a tuple with the ImplicitGrantIdTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetImplicitGrantIdTokenLifespanOk() (*string, bool) { - if o == nil || o.ImplicitGrantIdTokenLifespan == nil { + if o == nil || IsNil(o.ImplicitGrantIdTokenLifespan) { return nil, false } return o.ImplicitGrantIdTokenLifespan, true @@ -815,7 +818,7 @@ func (o *OAuth2Client) GetImplicitGrantIdTokenLifespanOk() (*string, bool) { // HasImplicitGrantIdTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasImplicitGrantIdTokenLifespan() bool { - if o != nil && o.ImplicitGrantIdTokenLifespan != nil { + if o != nil && !IsNil(o.ImplicitGrantIdTokenLifespan) { return true } @@ -840,7 +843,7 @@ func (o *OAuth2Client) GetJwks() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *OAuth2Client) GetJwksOk() (*interface{}, bool) { - if o == nil || o.Jwks == nil { + if o == nil || IsNil(o.Jwks) { return nil, false } return &o.Jwks, true @@ -848,7 +851,7 @@ func (o *OAuth2Client) GetJwksOk() (*interface{}, bool) { // HasJwks returns a boolean if a field has been set. func (o *OAuth2Client) HasJwks() bool { - if o != nil && o.Jwks != nil { + if o != nil && IsNil(o.Jwks) { return true } @@ -862,7 +865,7 @@ func (o *OAuth2Client) SetJwks(v interface{}) { // GetJwksUri returns the JwksUri field value if set, zero value otherwise. func (o *OAuth2Client) GetJwksUri() string { - if o == nil || o.JwksUri == nil { + if o == nil || IsNil(o.JwksUri) { var ret string return ret } @@ -872,7 +875,7 @@ func (o *OAuth2Client) GetJwksUri() string { // GetJwksUriOk returns a tuple with the JwksUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetJwksUriOk() (*string, bool) { - if o == nil || o.JwksUri == nil { + if o == nil || IsNil(o.JwksUri) { return nil, false } return o.JwksUri, true @@ -880,7 +883,7 @@ func (o *OAuth2Client) GetJwksUriOk() (*string, bool) { // HasJwksUri returns a boolean if a field has been set. func (o *OAuth2Client) HasJwksUri() bool { - if o != nil && o.JwksUri != nil { + if o != nil && !IsNil(o.JwksUri) { return true } @@ -894,7 +897,7 @@ func (o *OAuth2Client) SetJwksUri(v string) { // GetJwtBearerGrantAccessTokenLifespan returns the JwtBearerGrantAccessTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetJwtBearerGrantAccessTokenLifespan() string { - if o == nil || o.JwtBearerGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.JwtBearerGrantAccessTokenLifespan) { var ret string return ret } @@ -904,7 +907,7 @@ func (o *OAuth2Client) GetJwtBearerGrantAccessTokenLifespan() string { // GetJwtBearerGrantAccessTokenLifespanOk returns a tuple with the JwtBearerGrantAccessTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetJwtBearerGrantAccessTokenLifespanOk() (*string, bool) { - if o == nil || o.JwtBearerGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.JwtBearerGrantAccessTokenLifespan) { return nil, false } return o.JwtBearerGrantAccessTokenLifespan, true @@ -912,7 +915,7 @@ func (o *OAuth2Client) GetJwtBearerGrantAccessTokenLifespanOk() (*string, bool) // HasJwtBearerGrantAccessTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasJwtBearerGrantAccessTokenLifespan() bool { - if o != nil && o.JwtBearerGrantAccessTokenLifespan != nil { + if o != nil && !IsNil(o.JwtBearerGrantAccessTokenLifespan) { return true } @@ -926,7 +929,7 @@ func (o *OAuth2Client) SetJwtBearerGrantAccessTokenLifespan(v string) { // GetLogoUri returns the LogoUri field value if set, zero value otherwise. func (o *OAuth2Client) GetLogoUri() string { - if o == nil || o.LogoUri == nil { + if o == nil || IsNil(o.LogoUri) { var ret string return ret } @@ -936,7 +939,7 @@ func (o *OAuth2Client) GetLogoUri() string { // GetLogoUriOk returns a tuple with the LogoUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetLogoUriOk() (*string, bool) { - if o == nil || o.LogoUri == nil { + if o == nil || IsNil(o.LogoUri) { return nil, false } return o.LogoUri, true @@ -944,7 +947,7 @@ func (o *OAuth2Client) GetLogoUriOk() (*string, bool) { // HasLogoUri returns a boolean if a field has been set. func (o *OAuth2Client) HasLogoUri() bool { - if o != nil && o.LogoUri != nil { + if o != nil && !IsNil(o.LogoUri) { return true } @@ -969,7 +972,7 @@ func (o *OAuth2Client) GetMetadata() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *OAuth2Client) GetMetadataOk() (*interface{}, bool) { - if o == nil || o.Metadata == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } return &o.Metadata, true @@ -977,7 +980,7 @@ func (o *OAuth2Client) GetMetadataOk() (*interface{}, bool) { // HasMetadata returns a boolean if a field has been set. func (o *OAuth2Client) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && IsNil(o.Metadata) { return true } @@ -991,7 +994,7 @@ func (o *OAuth2Client) SetMetadata(v interface{}) { // GetOwner returns the Owner field value if set, zero value otherwise. func (o *OAuth2Client) GetOwner() string { - if o == nil || o.Owner == nil { + if o == nil || IsNil(o.Owner) { var ret string return ret } @@ -1001,7 +1004,7 @@ func (o *OAuth2Client) GetOwner() string { // GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetOwnerOk() (*string, bool) { - if o == nil || o.Owner == nil { + if o == nil || IsNil(o.Owner) { return nil, false } return o.Owner, true @@ -1009,7 +1012,7 @@ func (o *OAuth2Client) GetOwnerOk() (*string, bool) { // HasOwner returns a boolean if a field has been set. func (o *OAuth2Client) HasOwner() bool { - if o != nil && o.Owner != nil { + if o != nil && !IsNil(o.Owner) { return true } @@ -1023,7 +1026,7 @@ func (o *OAuth2Client) SetOwner(v string) { // GetPolicyUri returns the PolicyUri field value if set, zero value otherwise. func (o *OAuth2Client) GetPolicyUri() string { - if o == nil || o.PolicyUri == nil { + if o == nil || IsNil(o.PolicyUri) { var ret string return ret } @@ -1033,7 +1036,7 @@ func (o *OAuth2Client) GetPolicyUri() string { // GetPolicyUriOk returns a tuple with the PolicyUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetPolicyUriOk() (*string, bool) { - if o == nil || o.PolicyUri == nil { + if o == nil || IsNil(o.PolicyUri) { return nil, false } return o.PolicyUri, true @@ -1041,7 +1044,7 @@ func (o *OAuth2Client) GetPolicyUriOk() (*string, bool) { // HasPolicyUri returns a boolean if a field has been set. func (o *OAuth2Client) HasPolicyUri() bool { - if o != nil && o.PolicyUri != nil { + if o != nil && !IsNil(o.PolicyUri) { return true } @@ -1055,7 +1058,7 @@ func (o *OAuth2Client) SetPolicyUri(v string) { // GetPostLogoutRedirectUris returns the PostLogoutRedirectUris field value if set, zero value otherwise. func (o *OAuth2Client) GetPostLogoutRedirectUris() []string { - if o == nil || o.PostLogoutRedirectUris == nil { + if o == nil || IsNil(o.PostLogoutRedirectUris) { var ret []string return ret } @@ -1065,7 +1068,7 @@ func (o *OAuth2Client) GetPostLogoutRedirectUris() []string { // GetPostLogoutRedirectUrisOk returns a tuple with the PostLogoutRedirectUris field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetPostLogoutRedirectUrisOk() ([]string, bool) { - if o == nil || o.PostLogoutRedirectUris == nil { + if o == nil || IsNil(o.PostLogoutRedirectUris) { return nil, false } return o.PostLogoutRedirectUris, true @@ -1073,7 +1076,7 @@ func (o *OAuth2Client) GetPostLogoutRedirectUrisOk() ([]string, bool) { // HasPostLogoutRedirectUris returns a boolean if a field has been set. func (o *OAuth2Client) HasPostLogoutRedirectUris() bool { - if o != nil && o.PostLogoutRedirectUris != nil { + if o != nil && !IsNil(o.PostLogoutRedirectUris) { return true } @@ -1087,7 +1090,7 @@ func (o *OAuth2Client) SetPostLogoutRedirectUris(v []string) { // GetRedirectUris returns the RedirectUris field value if set, zero value otherwise. func (o *OAuth2Client) GetRedirectUris() []string { - if o == nil || o.RedirectUris == nil { + if o == nil || IsNil(o.RedirectUris) { var ret []string return ret } @@ -1097,7 +1100,7 @@ func (o *OAuth2Client) GetRedirectUris() []string { // GetRedirectUrisOk returns a tuple with the RedirectUris field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRedirectUrisOk() ([]string, bool) { - if o == nil || o.RedirectUris == nil { + if o == nil || IsNil(o.RedirectUris) { return nil, false } return o.RedirectUris, true @@ -1105,7 +1108,7 @@ func (o *OAuth2Client) GetRedirectUrisOk() ([]string, bool) { // HasRedirectUris returns a boolean if a field has been set. func (o *OAuth2Client) HasRedirectUris() bool { - if o != nil && o.RedirectUris != nil { + if o != nil && !IsNil(o.RedirectUris) { return true } @@ -1119,7 +1122,7 @@ func (o *OAuth2Client) SetRedirectUris(v []string) { // GetRefreshTokenGrantAccessTokenLifespan returns the RefreshTokenGrantAccessTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetRefreshTokenGrantAccessTokenLifespan() string { - if o == nil || o.RefreshTokenGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.RefreshTokenGrantAccessTokenLifespan) { var ret string return ret } @@ -1129,7 +1132,7 @@ func (o *OAuth2Client) GetRefreshTokenGrantAccessTokenLifespan() string { // GetRefreshTokenGrantAccessTokenLifespanOk returns a tuple with the RefreshTokenGrantAccessTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRefreshTokenGrantAccessTokenLifespanOk() (*string, bool) { - if o == nil || o.RefreshTokenGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.RefreshTokenGrantAccessTokenLifespan) { return nil, false } return o.RefreshTokenGrantAccessTokenLifespan, true @@ -1137,7 +1140,7 @@ func (o *OAuth2Client) GetRefreshTokenGrantAccessTokenLifespanOk() (*string, boo // HasRefreshTokenGrantAccessTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasRefreshTokenGrantAccessTokenLifespan() bool { - if o != nil && o.RefreshTokenGrantAccessTokenLifespan != nil { + if o != nil && !IsNil(o.RefreshTokenGrantAccessTokenLifespan) { return true } @@ -1151,7 +1154,7 @@ func (o *OAuth2Client) SetRefreshTokenGrantAccessTokenLifespan(v string) { // GetRefreshTokenGrantIdTokenLifespan returns the RefreshTokenGrantIdTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetRefreshTokenGrantIdTokenLifespan() string { - if o == nil || o.RefreshTokenGrantIdTokenLifespan == nil { + if o == nil || IsNil(o.RefreshTokenGrantIdTokenLifespan) { var ret string return ret } @@ -1161,7 +1164,7 @@ func (o *OAuth2Client) GetRefreshTokenGrantIdTokenLifespan() string { // GetRefreshTokenGrantIdTokenLifespanOk returns a tuple with the RefreshTokenGrantIdTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRefreshTokenGrantIdTokenLifespanOk() (*string, bool) { - if o == nil || o.RefreshTokenGrantIdTokenLifespan == nil { + if o == nil || IsNil(o.RefreshTokenGrantIdTokenLifespan) { return nil, false } return o.RefreshTokenGrantIdTokenLifespan, true @@ -1169,7 +1172,7 @@ func (o *OAuth2Client) GetRefreshTokenGrantIdTokenLifespanOk() (*string, bool) { // HasRefreshTokenGrantIdTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasRefreshTokenGrantIdTokenLifespan() bool { - if o != nil && o.RefreshTokenGrantIdTokenLifespan != nil { + if o != nil && !IsNil(o.RefreshTokenGrantIdTokenLifespan) { return true } @@ -1183,7 +1186,7 @@ func (o *OAuth2Client) SetRefreshTokenGrantIdTokenLifespan(v string) { // GetRefreshTokenGrantRefreshTokenLifespan returns the RefreshTokenGrantRefreshTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetRefreshTokenGrantRefreshTokenLifespan() string { - if o == nil || o.RefreshTokenGrantRefreshTokenLifespan == nil { + if o == nil || IsNil(o.RefreshTokenGrantRefreshTokenLifespan) { var ret string return ret } @@ -1193,7 +1196,7 @@ func (o *OAuth2Client) GetRefreshTokenGrantRefreshTokenLifespan() string { // GetRefreshTokenGrantRefreshTokenLifespanOk returns a tuple with the RefreshTokenGrantRefreshTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRefreshTokenGrantRefreshTokenLifespanOk() (*string, bool) { - if o == nil || o.RefreshTokenGrantRefreshTokenLifespan == nil { + if o == nil || IsNil(o.RefreshTokenGrantRefreshTokenLifespan) { return nil, false } return o.RefreshTokenGrantRefreshTokenLifespan, true @@ -1201,7 +1204,7 @@ func (o *OAuth2Client) GetRefreshTokenGrantRefreshTokenLifespanOk() (*string, bo // HasRefreshTokenGrantRefreshTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasRefreshTokenGrantRefreshTokenLifespan() bool { - if o != nil && o.RefreshTokenGrantRefreshTokenLifespan != nil { + if o != nil && !IsNil(o.RefreshTokenGrantRefreshTokenLifespan) { return true } @@ -1215,7 +1218,7 @@ func (o *OAuth2Client) SetRefreshTokenGrantRefreshTokenLifespan(v string) { // GetRegistrationAccessToken returns the RegistrationAccessToken field value if set, zero value otherwise. func (o *OAuth2Client) GetRegistrationAccessToken() string { - if o == nil || o.RegistrationAccessToken == nil { + if o == nil || IsNil(o.RegistrationAccessToken) { var ret string return ret } @@ -1225,7 +1228,7 @@ func (o *OAuth2Client) GetRegistrationAccessToken() string { // GetRegistrationAccessTokenOk returns a tuple with the RegistrationAccessToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRegistrationAccessTokenOk() (*string, bool) { - if o == nil || o.RegistrationAccessToken == nil { + if o == nil || IsNil(o.RegistrationAccessToken) { return nil, false } return o.RegistrationAccessToken, true @@ -1233,7 +1236,7 @@ func (o *OAuth2Client) GetRegistrationAccessTokenOk() (*string, bool) { // HasRegistrationAccessToken returns a boolean if a field has been set. func (o *OAuth2Client) HasRegistrationAccessToken() bool { - if o != nil && o.RegistrationAccessToken != nil { + if o != nil && !IsNil(o.RegistrationAccessToken) { return true } @@ -1247,7 +1250,7 @@ func (o *OAuth2Client) SetRegistrationAccessToken(v string) { // GetRegistrationClientUri returns the RegistrationClientUri field value if set, zero value otherwise. func (o *OAuth2Client) GetRegistrationClientUri() string { - if o == nil || o.RegistrationClientUri == nil { + if o == nil || IsNil(o.RegistrationClientUri) { var ret string return ret } @@ -1257,7 +1260,7 @@ func (o *OAuth2Client) GetRegistrationClientUri() string { // GetRegistrationClientUriOk returns a tuple with the RegistrationClientUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRegistrationClientUriOk() (*string, bool) { - if o == nil || o.RegistrationClientUri == nil { + if o == nil || IsNil(o.RegistrationClientUri) { return nil, false } return o.RegistrationClientUri, true @@ -1265,7 +1268,7 @@ func (o *OAuth2Client) GetRegistrationClientUriOk() (*string, bool) { // HasRegistrationClientUri returns a boolean if a field has been set. func (o *OAuth2Client) HasRegistrationClientUri() bool { - if o != nil && o.RegistrationClientUri != nil { + if o != nil && !IsNil(o.RegistrationClientUri) { return true } @@ -1279,7 +1282,7 @@ func (o *OAuth2Client) SetRegistrationClientUri(v string) { // GetRequestObjectSigningAlg returns the RequestObjectSigningAlg field value if set, zero value otherwise. func (o *OAuth2Client) GetRequestObjectSigningAlg() string { - if o == nil || o.RequestObjectSigningAlg == nil { + if o == nil || IsNil(o.RequestObjectSigningAlg) { var ret string return ret } @@ -1289,7 +1292,7 @@ func (o *OAuth2Client) GetRequestObjectSigningAlg() string { // GetRequestObjectSigningAlgOk returns a tuple with the RequestObjectSigningAlg field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRequestObjectSigningAlgOk() (*string, bool) { - if o == nil || o.RequestObjectSigningAlg == nil { + if o == nil || IsNil(o.RequestObjectSigningAlg) { return nil, false } return o.RequestObjectSigningAlg, true @@ -1297,7 +1300,7 @@ func (o *OAuth2Client) GetRequestObjectSigningAlgOk() (*string, bool) { // HasRequestObjectSigningAlg returns a boolean if a field has been set. func (o *OAuth2Client) HasRequestObjectSigningAlg() bool { - if o != nil && o.RequestObjectSigningAlg != nil { + if o != nil && !IsNil(o.RequestObjectSigningAlg) { return true } @@ -1311,7 +1314,7 @@ func (o *OAuth2Client) SetRequestObjectSigningAlg(v string) { // GetRequestUris returns the RequestUris field value if set, zero value otherwise. func (o *OAuth2Client) GetRequestUris() []string { - if o == nil || o.RequestUris == nil { + if o == nil || IsNil(o.RequestUris) { var ret []string return ret } @@ -1321,7 +1324,7 @@ func (o *OAuth2Client) GetRequestUris() []string { // GetRequestUrisOk returns a tuple with the RequestUris field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRequestUrisOk() ([]string, bool) { - if o == nil || o.RequestUris == nil { + if o == nil || IsNil(o.RequestUris) { return nil, false } return o.RequestUris, true @@ -1329,7 +1332,7 @@ func (o *OAuth2Client) GetRequestUrisOk() ([]string, bool) { // HasRequestUris returns a boolean if a field has been set. func (o *OAuth2Client) HasRequestUris() bool { - if o != nil && o.RequestUris != nil { + if o != nil && !IsNil(o.RequestUris) { return true } @@ -1343,7 +1346,7 @@ func (o *OAuth2Client) SetRequestUris(v []string) { // GetResponseTypes returns the ResponseTypes field value if set, zero value otherwise. func (o *OAuth2Client) GetResponseTypes() []string { - if o == nil || o.ResponseTypes == nil { + if o == nil || IsNil(o.ResponseTypes) { var ret []string return ret } @@ -1353,7 +1356,7 @@ func (o *OAuth2Client) GetResponseTypes() []string { // GetResponseTypesOk returns a tuple with the ResponseTypes field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetResponseTypesOk() ([]string, bool) { - if o == nil || o.ResponseTypes == nil { + if o == nil || IsNil(o.ResponseTypes) { return nil, false } return o.ResponseTypes, true @@ -1361,7 +1364,7 @@ func (o *OAuth2Client) GetResponseTypesOk() ([]string, bool) { // HasResponseTypes returns a boolean if a field has been set. func (o *OAuth2Client) HasResponseTypes() bool { - if o != nil && o.ResponseTypes != nil { + if o != nil && !IsNil(o.ResponseTypes) { return true } @@ -1375,7 +1378,7 @@ func (o *OAuth2Client) SetResponseTypes(v []string) { // GetScope returns the Scope field value if set, zero value otherwise. func (o *OAuth2Client) GetScope() string { - if o == nil || o.Scope == nil { + if o == nil || IsNil(o.Scope) { var ret string return ret } @@ -1385,7 +1388,7 @@ func (o *OAuth2Client) GetScope() string { // GetScopeOk returns a tuple with the Scope field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetScopeOk() (*string, bool) { - if o == nil || o.Scope == nil { + if o == nil || IsNil(o.Scope) { return nil, false } return o.Scope, true @@ -1393,7 +1396,7 @@ func (o *OAuth2Client) GetScopeOk() (*string, bool) { // HasScope returns a boolean if a field has been set. func (o *OAuth2Client) HasScope() bool { - if o != nil && o.Scope != nil { + if o != nil && !IsNil(o.Scope) { return true } @@ -1407,7 +1410,7 @@ func (o *OAuth2Client) SetScope(v string) { // GetSectorIdentifierUri returns the SectorIdentifierUri field value if set, zero value otherwise. func (o *OAuth2Client) GetSectorIdentifierUri() string { - if o == nil || o.SectorIdentifierUri == nil { + if o == nil || IsNil(o.SectorIdentifierUri) { var ret string return ret } @@ -1417,7 +1420,7 @@ func (o *OAuth2Client) GetSectorIdentifierUri() string { // GetSectorIdentifierUriOk returns a tuple with the SectorIdentifierUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetSectorIdentifierUriOk() (*string, bool) { - if o == nil || o.SectorIdentifierUri == nil { + if o == nil || IsNil(o.SectorIdentifierUri) { return nil, false } return o.SectorIdentifierUri, true @@ -1425,7 +1428,7 @@ func (o *OAuth2Client) GetSectorIdentifierUriOk() (*string, bool) { // HasSectorIdentifierUri returns a boolean if a field has been set. func (o *OAuth2Client) HasSectorIdentifierUri() bool { - if o != nil && o.SectorIdentifierUri != nil { + if o != nil && !IsNil(o.SectorIdentifierUri) { return true } @@ -1439,7 +1442,7 @@ func (o *OAuth2Client) SetSectorIdentifierUri(v string) { // GetSkipConsent returns the SkipConsent field value if set, zero value otherwise. func (o *OAuth2Client) GetSkipConsent() bool { - if o == nil || o.SkipConsent == nil { + if o == nil || IsNil(o.SkipConsent) { var ret bool return ret } @@ -1449,7 +1452,7 @@ func (o *OAuth2Client) GetSkipConsent() bool { // GetSkipConsentOk returns a tuple with the SkipConsent field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetSkipConsentOk() (*bool, bool) { - if o == nil || o.SkipConsent == nil { + if o == nil || IsNil(o.SkipConsent) { return nil, false } return o.SkipConsent, true @@ -1457,7 +1460,7 @@ func (o *OAuth2Client) GetSkipConsentOk() (*bool, bool) { // HasSkipConsent returns a boolean if a field has been set. func (o *OAuth2Client) HasSkipConsent() bool { - if o != nil && o.SkipConsent != nil { + if o != nil && !IsNil(o.SkipConsent) { return true } @@ -1471,7 +1474,7 @@ func (o *OAuth2Client) SetSkipConsent(v bool) { // GetSubjectType returns the SubjectType field value if set, zero value otherwise. func (o *OAuth2Client) GetSubjectType() string { - if o == nil || o.SubjectType == nil { + if o == nil || IsNil(o.SubjectType) { var ret string return ret } @@ -1481,7 +1484,7 @@ func (o *OAuth2Client) GetSubjectType() string { // GetSubjectTypeOk returns a tuple with the SubjectType field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetSubjectTypeOk() (*string, bool) { - if o == nil || o.SubjectType == nil { + if o == nil || IsNil(o.SubjectType) { return nil, false } return o.SubjectType, true @@ -1489,7 +1492,7 @@ func (o *OAuth2Client) GetSubjectTypeOk() (*string, bool) { // HasSubjectType returns a boolean if a field has been set. func (o *OAuth2Client) HasSubjectType() bool { - if o != nil && o.SubjectType != nil { + if o != nil && !IsNil(o.SubjectType) { return true } @@ -1503,7 +1506,7 @@ func (o *OAuth2Client) SetSubjectType(v string) { // GetTokenEndpointAuthMethod returns the TokenEndpointAuthMethod field value if set, zero value otherwise. func (o *OAuth2Client) GetTokenEndpointAuthMethod() string { - if o == nil || o.TokenEndpointAuthMethod == nil { + if o == nil || IsNil(o.TokenEndpointAuthMethod) { var ret string return ret } @@ -1513,7 +1516,7 @@ func (o *OAuth2Client) GetTokenEndpointAuthMethod() string { // GetTokenEndpointAuthMethodOk returns a tuple with the TokenEndpointAuthMethod field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetTokenEndpointAuthMethodOk() (*string, bool) { - if o == nil || o.TokenEndpointAuthMethod == nil { + if o == nil || IsNil(o.TokenEndpointAuthMethod) { return nil, false } return o.TokenEndpointAuthMethod, true @@ -1521,7 +1524,7 @@ func (o *OAuth2Client) GetTokenEndpointAuthMethodOk() (*string, bool) { // HasTokenEndpointAuthMethod returns a boolean if a field has been set. func (o *OAuth2Client) HasTokenEndpointAuthMethod() bool { - if o != nil && o.TokenEndpointAuthMethod != nil { + if o != nil && !IsNil(o.TokenEndpointAuthMethod) { return true } @@ -1535,7 +1538,7 @@ func (o *OAuth2Client) SetTokenEndpointAuthMethod(v string) { // GetTokenEndpointAuthSigningAlg returns the TokenEndpointAuthSigningAlg field value if set, zero value otherwise. func (o *OAuth2Client) GetTokenEndpointAuthSigningAlg() string { - if o == nil || o.TokenEndpointAuthSigningAlg == nil { + if o == nil || IsNil(o.TokenEndpointAuthSigningAlg) { var ret string return ret } @@ -1545,7 +1548,7 @@ func (o *OAuth2Client) GetTokenEndpointAuthSigningAlg() string { // GetTokenEndpointAuthSigningAlgOk returns a tuple with the TokenEndpointAuthSigningAlg field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetTokenEndpointAuthSigningAlgOk() (*string, bool) { - if o == nil || o.TokenEndpointAuthSigningAlg == nil { + if o == nil || IsNil(o.TokenEndpointAuthSigningAlg) { return nil, false } return o.TokenEndpointAuthSigningAlg, true @@ -1553,7 +1556,7 @@ func (o *OAuth2Client) GetTokenEndpointAuthSigningAlgOk() (*string, bool) { // HasTokenEndpointAuthSigningAlg returns a boolean if a field has been set. func (o *OAuth2Client) HasTokenEndpointAuthSigningAlg() bool { - if o != nil && o.TokenEndpointAuthSigningAlg != nil { + if o != nil && !IsNil(o.TokenEndpointAuthSigningAlg) { return true } @@ -1567,7 +1570,7 @@ func (o *OAuth2Client) SetTokenEndpointAuthSigningAlg(v string) { // GetTosUri returns the TosUri field value if set, zero value otherwise. func (o *OAuth2Client) GetTosUri() string { - if o == nil || o.TosUri == nil { + if o == nil || IsNil(o.TosUri) { var ret string return ret } @@ -1577,7 +1580,7 @@ func (o *OAuth2Client) GetTosUri() string { // GetTosUriOk returns a tuple with the TosUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetTosUriOk() (*string, bool) { - if o == nil || o.TosUri == nil { + if o == nil || IsNil(o.TosUri) { return nil, false } return o.TosUri, true @@ -1585,7 +1588,7 @@ func (o *OAuth2Client) GetTosUriOk() (*string, bool) { // HasTosUri returns a boolean if a field has been set. func (o *OAuth2Client) HasTosUri() bool { - if o != nil && o.TosUri != nil { + if o != nil && !IsNil(o.TosUri) { return true } @@ -1599,7 +1602,7 @@ func (o *OAuth2Client) SetTosUri(v string) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *OAuth2Client) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -1609,7 +1612,7 @@ func (o *OAuth2Client) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -1617,7 +1620,7 @@ func (o *OAuth2Client) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *OAuth2Client) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -1631,7 +1634,7 @@ func (o *OAuth2Client) SetUpdatedAt(v time.Time) { // GetUserinfoSignedResponseAlg returns the UserinfoSignedResponseAlg field value if set, zero value otherwise. func (o *OAuth2Client) GetUserinfoSignedResponseAlg() string { - if o == nil || o.UserinfoSignedResponseAlg == nil { + if o == nil || IsNil(o.UserinfoSignedResponseAlg) { var ret string return ret } @@ -1641,7 +1644,7 @@ func (o *OAuth2Client) GetUserinfoSignedResponseAlg() string { // GetUserinfoSignedResponseAlgOk returns a tuple with the UserinfoSignedResponseAlg field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetUserinfoSignedResponseAlgOk() (*string, bool) { - if o == nil || o.UserinfoSignedResponseAlg == nil { + if o == nil || IsNil(o.UserinfoSignedResponseAlg) { return nil, false } return o.UserinfoSignedResponseAlg, true @@ -1649,7 +1652,7 @@ func (o *OAuth2Client) GetUserinfoSignedResponseAlgOk() (*string, bool) { // HasUserinfoSignedResponseAlg returns a boolean if a field has been set. func (o *OAuth2Client) HasUserinfoSignedResponseAlg() bool { - if o != nil && o.UserinfoSignedResponseAlg != nil { + if o != nil && !IsNil(o.UserinfoSignedResponseAlg) { return true } @@ -1662,152 +1665,160 @@ func (o *OAuth2Client) SetUserinfoSignedResponseAlg(v string) { } func (o OAuth2Client) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OAuth2Client) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.AdditionalPropertiesField != nil { + if !IsNil(o.AdditionalPropertiesField) { toSerialize["AdditionalProperties"] = o.AdditionalPropertiesField } - if o.AccessTokenStrategy != nil { + if !IsNil(o.AccessTokenStrategy) { toSerialize["access_token_strategy"] = o.AccessTokenStrategy } - if o.AllowedCorsOrigins != nil { + if !IsNil(o.AllowedCorsOrigins) { toSerialize["allowed_cors_origins"] = o.AllowedCorsOrigins } - if o.Audience != nil { + if !IsNil(o.Audience) { toSerialize["audience"] = o.Audience } - if o.AuthorizationCodeGrantAccessTokenLifespan != nil { + if !IsNil(o.AuthorizationCodeGrantAccessTokenLifespan) { toSerialize["authorization_code_grant_access_token_lifespan"] = o.AuthorizationCodeGrantAccessTokenLifespan } - if o.AuthorizationCodeGrantIdTokenLifespan != nil { + if !IsNil(o.AuthorizationCodeGrantIdTokenLifespan) { toSerialize["authorization_code_grant_id_token_lifespan"] = o.AuthorizationCodeGrantIdTokenLifespan } - if o.AuthorizationCodeGrantRefreshTokenLifespan != nil { + if !IsNil(o.AuthorizationCodeGrantRefreshTokenLifespan) { toSerialize["authorization_code_grant_refresh_token_lifespan"] = o.AuthorizationCodeGrantRefreshTokenLifespan } - if o.BackchannelLogoutSessionRequired != nil { + if !IsNil(o.BackchannelLogoutSessionRequired) { toSerialize["backchannel_logout_session_required"] = o.BackchannelLogoutSessionRequired } - if o.BackchannelLogoutUri != nil { + if !IsNil(o.BackchannelLogoutUri) { toSerialize["backchannel_logout_uri"] = o.BackchannelLogoutUri } - if o.ClientCredentialsGrantAccessTokenLifespan != nil { + if !IsNil(o.ClientCredentialsGrantAccessTokenLifespan) { toSerialize["client_credentials_grant_access_token_lifespan"] = o.ClientCredentialsGrantAccessTokenLifespan } - if o.ClientId != nil { + if !IsNil(o.ClientId) { toSerialize["client_id"] = o.ClientId } - if o.ClientName != nil { + if !IsNil(o.ClientName) { toSerialize["client_name"] = o.ClientName } - if o.ClientSecret != nil { + if !IsNil(o.ClientSecret) { toSerialize["client_secret"] = o.ClientSecret } - if o.ClientSecretExpiresAt != nil { + if !IsNil(o.ClientSecretExpiresAt) { toSerialize["client_secret_expires_at"] = o.ClientSecretExpiresAt } - if o.ClientUri != nil { + if !IsNil(o.ClientUri) { toSerialize["client_uri"] = o.ClientUri } - if o.Contacts != nil { + if !IsNil(o.Contacts) { toSerialize["contacts"] = o.Contacts } - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if o.FrontchannelLogoutSessionRequired != nil { + if !IsNil(o.FrontchannelLogoutSessionRequired) { toSerialize["frontchannel_logout_session_required"] = o.FrontchannelLogoutSessionRequired } - if o.FrontchannelLogoutUri != nil { + if !IsNil(o.FrontchannelLogoutUri) { toSerialize["frontchannel_logout_uri"] = o.FrontchannelLogoutUri } - if o.GrantTypes != nil { + if !IsNil(o.GrantTypes) { toSerialize["grant_types"] = o.GrantTypes } - if o.ImplicitGrantAccessTokenLifespan != nil { + if !IsNil(o.ImplicitGrantAccessTokenLifespan) { toSerialize["implicit_grant_access_token_lifespan"] = o.ImplicitGrantAccessTokenLifespan } - if o.ImplicitGrantIdTokenLifespan != nil { + if !IsNil(o.ImplicitGrantIdTokenLifespan) { toSerialize["implicit_grant_id_token_lifespan"] = o.ImplicitGrantIdTokenLifespan } if o.Jwks != nil { toSerialize["jwks"] = o.Jwks } - if o.JwksUri != nil { + if !IsNil(o.JwksUri) { toSerialize["jwks_uri"] = o.JwksUri } - if o.JwtBearerGrantAccessTokenLifespan != nil { + if !IsNil(o.JwtBearerGrantAccessTokenLifespan) { toSerialize["jwt_bearer_grant_access_token_lifespan"] = o.JwtBearerGrantAccessTokenLifespan } - if o.LogoUri != nil { + if !IsNil(o.LogoUri) { toSerialize["logo_uri"] = o.LogoUri } if o.Metadata != nil { toSerialize["metadata"] = o.Metadata } - if o.Owner != nil { + if !IsNil(o.Owner) { toSerialize["owner"] = o.Owner } - if o.PolicyUri != nil { + if !IsNil(o.PolicyUri) { toSerialize["policy_uri"] = o.PolicyUri } - if o.PostLogoutRedirectUris != nil { + if !IsNil(o.PostLogoutRedirectUris) { toSerialize["post_logout_redirect_uris"] = o.PostLogoutRedirectUris } - if o.RedirectUris != nil { + if !IsNil(o.RedirectUris) { toSerialize["redirect_uris"] = o.RedirectUris } - if o.RefreshTokenGrantAccessTokenLifespan != nil { + if !IsNil(o.RefreshTokenGrantAccessTokenLifespan) { toSerialize["refresh_token_grant_access_token_lifespan"] = o.RefreshTokenGrantAccessTokenLifespan } - if o.RefreshTokenGrantIdTokenLifespan != nil { + if !IsNil(o.RefreshTokenGrantIdTokenLifespan) { toSerialize["refresh_token_grant_id_token_lifespan"] = o.RefreshTokenGrantIdTokenLifespan } - if o.RefreshTokenGrantRefreshTokenLifespan != nil { + if !IsNil(o.RefreshTokenGrantRefreshTokenLifespan) { toSerialize["refresh_token_grant_refresh_token_lifespan"] = o.RefreshTokenGrantRefreshTokenLifespan } - if o.RegistrationAccessToken != nil { + if !IsNil(o.RegistrationAccessToken) { toSerialize["registration_access_token"] = o.RegistrationAccessToken } - if o.RegistrationClientUri != nil { + if !IsNil(o.RegistrationClientUri) { toSerialize["registration_client_uri"] = o.RegistrationClientUri } - if o.RequestObjectSigningAlg != nil { + if !IsNil(o.RequestObjectSigningAlg) { toSerialize["request_object_signing_alg"] = o.RequestObjectSigningAlg } - if o.RequestUris != nil { + if !IsNil(o.RequestUris) { toSerialize["request_uris"] = o.RequestUris } - if o.ResponseTypes != nil { + if !IsNil(o.ResponseTypes) { toSerialize["response_types"] = o.ResponseTypes } - if o.Scope != nil { + if !IsNil(o.Scope) { toSerialize["scope"] = o.Scope } - if o.SectorIdentifierUri != nil { + if !IsNil(o.SectorIdentifierUri) { toSerialize["sector_identifier_uri"] = o.SectorIdentifierUri } - if o.SkipConsent != nil { + if !IsNil(o.SkipConsent) { toSerialize["skip_consent"] = o.SkipConsent } - if o.SubjectType != nil { + if !IsNil(o.SubjectType) { toSerialize["subject_type"] = o.SubjectType } - if o.TokenEndpointAuthMethod != nil { + if !IsNil(o.TokenEndpointAuthMethod) { toSerialize["token_endpoint_auth_method"] = o.TokenEndpointAuthMethod } - if o.TokenEndpointAuthSigningAlg != nil { + if !IsNil(o.TokenEndpointAuthSigningAlg) { toSerialize["token_endpoint_auth_signing_alg"] = o.TokenEndpointAuthSigningAlg } - if o.TosUri != nil { + if !IsNil(o.TosUri) { toSerialize["tos_uri"] = o.TosUri } - if o.UpdatedAt != nil { + if !IsNil(o.UpdatedAt) { toSerialize["updated_at"] = o.UpdatedAt } - if o.UserinfoSignedResponseAlg != nil { + if !IsNil(o.UserinfoSignedResponseAlg) { toSerialize["userinfo_signed_response_alg"] = o.UserinfoSignedResponseAlg } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableOAuth2Client struct { diff --git a/internal/client-go/model_o_auth2_consent_request_open_id_connect_context.go b/internal/client-go/model_o_auth2_consent_request_open_id_connect_context.go index 68884830a9ee..8daf562f15f2 100644 --- a/internal/client-go/model_o_auth2_consent_request_open_id_connect_context.go +++ b/internal/client-go/model_o_auth2_consent_request_open_id_connect_context.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the OAuth2ConsentRequestOpenIDConnectContext type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OAuth2ConsentRequestOpenIDConnectContext{} + // OAuth2ConsentRequestOpenIDConnectContext OAuth2ConsentRequestOpenIDConnectContext struct for OAuth2ConsentRequestOpenIDConnectContext type OAuth2ConsentRequestOpenIDConnectContext struct { AdditionalPropertiesField map[string]interface{} `json:"AdditionalProperties,omitempty"` @@ -49,7 +52,7 @@ func NewOAuth2ConsentRequestOpenIDConnectContextWithDefaults() *OAuth2ConsentReq // GetAdditionalPropertiesField returns the AdditionalPropertiesField field value if set, zero value otherwise. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAdditionalPropertiesField() map[string]interface{} { - if o == nil || o.AdditionalPropertiesField == nil { + if o == nil || IsNil(o.AdditionalPropertiesField) { var ret map[string]interface{} return ret } @@ -59,15 +62,15 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAdditionalPropertiesField( // GetAdditionalPropertiesFieldOk returns a tuple with the AdditionalPropertiesField field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAdditionalPropertiesFieldOk() (map[string]interface{}, bool) { - if o == nil || o.AdditionalPropertiesField == nil { - return nil, false + if o == nil || IsNil(o.AdditionalPropertiesField) { + return map[string]interface{}{}, false } return o.AdditionalPropertiesField, true } // HasAdditionalPropertiesField returns a boolean if a field has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) HasAdditionalPropertiesField() bool { - if o != nil && o.AdditionalPropertiesField != nil { + if o != nil && !IsNil(o.AdditionalPropertiesField) { return true } @@ -81,7 +84,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) SetAdditionalPropertiesField( // GetAcrValues returns the AcrValues field value if set, zero value otherwise. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAcrValues() []string { - if o == nil || o.AcrValues == nil { + if o == nil || IsNil(o.AcrValues) { var ret []string return ret } @@ -91,7 +94,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAcrValues() []string { // GetAcrValuesOk returns a tuple with the AcrValues field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAcrValuesOk() ([]string, bool) { - if o == nil || o.AcrValues == nil { + if o == nil || IsNil(o.AcrValues) { return nil, false } return o.AcrValues, true @@ -99,7 +102,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAcrValuesOk() ([]string, b // HasAcrValues returns a boolean if a field has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) HasAcrValues() bool { - if o != nil && o.AcrValues != nil { + if o != nil && !IsNil(o.AcrValues) { return true } @@ -113,7 +116,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) SetAcrValues(v []string) { // GetDisplay returns the Display field value if set, zero value otherwise. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetDisplay() string { - if o == nil || o.Display == nil { + if o == nil || IsNil(o.Display) { var ret string return ret } @@ -123,7 +126,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetDisplay() string { // GetDisplayOk returns a tuple with the Display field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetDisplayOk() (*string, bool) { - if o == nil || o.Display == nil { + if o == nil || IsNil(o.Display) { return nil, false } return o.Display, true @@ -131,7 +134,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetDisplayOk() (*string, bool // HasDisplay returns a boolean if a field has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) HasDisplay() bool { - if o != nil && o.Display != nil { + if o != nil && !IsNil(o.Display) { return true } @@ -145,7 +148,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) SetDisplay(v string) { // GetIdTokenHintClaims returns the IdTokenHintClaims field value if set, zero value otherwise. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetIdTokenHintClaims() map[string]interface{} { - if o == nil || o.IdTokenHintClaims == nil { + if o == nil || IsNil(o.IdTokenHintClaims) { var ret map[string]interface{} return ret } @@ -155,15 +158,15 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetIdTokenHintClaims() map[st // GetIdTokenHintClaimsOk returns a tuple with the IdTokenHintClaims field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetIdTokenHintClaimsOk() (map[string]interface{}, bool) { - if o == nil || o.IdTokenHintClaims == nil { - return nil, false + if o == nil || IsNil(o.IdTokenHintClaims) { + return map[string]interface{}{}, false } return o.IdTokenHintClaims, true } // HasIdTokenHintClaims returns a boolean if a field has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) HasIdTokenHintClaims() bool { - if o != nil && o.IdTokenHintClaims != nil { + if o != nil && !IsNil(o.IdTokenHintClaims) { return true } @@ -177,7 +180,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) SetIdTokenHintClaims(v map[st // GetLoginHint returns the LoginHint field value if set, zero value otherwise. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetLoginHint() string { - if o == nil || o.LoginHint == nil { + if o == nil || IsNil(o.LoginHint) { var ret string return ret } @@ -187,7 +190,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetLoginHint() string { // GetLoginHintOk returns a tuple with the LoginHint field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetLoginHintOk() (*string, bool) { - if o == nil || o.LoginHint == nil { + if o == nil || IsNil(o.LoginHint) { return nil, false } return o.LoginHint, true @@ -195,7 +198,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetLoginHintOk() (*string, bo // HasLoginHint returns a boolean if a field has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) HasLoginHint() bool { - if o != nil && o.LoginHint != nil { + if o != nil && !IsNil(o.LoginHint) { return true } @@ -209,7 +212,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) SetLoginHint(v string) { // GetUiLocales returns the UiLocales field value if set, zero value otherwise. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetUiLocales() []string { - if o == nil || o.UiLocales == nil { + if o == nil || IsNil(o.UiLocales) { var ret []string return ret } @@ -219,7 +222,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetUiLocales() []string { // GetUiLocalesOk returns a tuple with the UiLocales field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetUiLocalesOk() ([]string, bool) { - if o == nil || o.UiLocales == nil { + if o == nil || IsNil(o.UiLocales) { return nil, false } return o.UiLocales, true @@ -227,7 +230,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetUiLocalesOk() ([]string, b // HasUiLocales returns a boolean if a field has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) HasUiLocales() bool { - if o != nil && o.UiLocales != nil { + if o != nil && !IsNil(o.UiLocales) { return true } @@ -240,26 +243,34 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) SetUiLocales(v []string) { } func (o OAuth2ConsentRequestOpenIDConnectContext) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OAuth2ConsentRequestOpenIDConnectContext) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.AdditionalPropertiesField != nil { + if !IsNil(o.AdditionalPropertiesField) { toSerialize["AdditionalProperties"] = o.AdditionalPropertiesField } - if o.AcrValues != nil { + if !IsNil(o.AcrValues) { toSerialize["acr_values"] = o.AcrValues } - if o.Display != nil { + if !IsNil(o.Display) { toSerialize["display"] = o.Display } - if o.IdTokenHintClaims != nil { + if !IsNil(o.IdTokenHintClaims) { toSerialize["id_token_hint_claims"] = o.IdTokenHintClaims } - if o.LoginHint != nil { + if !IsNil(o.LoginHint) { toSerialize["login_hint"] = o.LoginHint } - if o.UiLocales != nil { + if !IsNil(o.UiLocales) { toSerialize["ui_locales"] = o.UiLocales } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableOAuth2ConsentRequestOpenIDConnectContext struct { diff --git a/internal/client-go/model_o_auth2_login_request.go b/internal/client-go/model_o_auth2_login_request.go index a788c66ed3ca..8584a570e6b9 100644 --- a/internal/client-go/model_o_auth2_login_request.go +++ b/internal/client-go/model_o_auth2_login_request.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the OAuth2LoginRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OAuth2LoginRequest{} + // OAuth2LoginRequest OAuth2LoginRequest struct for OAuth2LoginRequest type OAuth2LoginRequest struct { AdditionalPropertiesField map[string]interface{} `json:"AdditionalProperties,omitempty"` @@ -53,7 +56,7 @@ func NewOAuth2LoginRequestWithDefaults() *OAuth2LoginRequest { // GetAdditionalPropertiesField returns the AdditionalPropertiesField field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetAdditionalPropertiesField() map[string]interface{} { - if o == nil || o.AdditionalPropertiesField == nil { + if o == nil || IsNil(o.AdditionalPropertiesField) { var ret map[string]interface{} return ret } @@ -63,15 +66,15 @@ func (o *OAuth2LoginRequest) GetAdditionalPropertiesField() map[string]interface // GetAdditionalPropertiesFieldOk returns a tuple with the AdditionalPropertiesField field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetAdditionalPropertiesFieldOk() (map[string]interface{}, bool) { - if o == nil || o.AdditionalPropertiesField == nil { - return nil, false + if o == nil || IsNil(o.AdditionalPropertiesField) { + return map[string]interface{}{}, false } return o.AdditionalPropertiesField, true } // HasAdditionalPropertiesField returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasAdditionalPropertiesField() bool { - if o != nil && o.AdditionalPropertiesField != nil { + if o != nil && !IsNil(o.AdditionalPropertiesField) { return true } @@ -85,7 +88,7 @@ func (o *OAuth2LoginRequest) SetAdditionalPropertiesField(v map[string]interface // GetChallenge returns the Challenge field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetChallenge() string { - if o == nil || o.Challenge == nil { + if o == nil || IsNil(o.Challenge) { var ret string return ret } @@ -95,7 +98,7 @@ func (o *OAuth2LoginRequest) GetChallenge() string { // GetChallengeOk returns a tuple with the Challenge field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetChallengeOk() (*string, bool) { - if o == nil || o.Challenge == nil { + if o == nil || IsNil(o.Challenge) { return nil, false } return o.Challenge, true @@ -103,7 +106,7 @@ func (o *OAuth2LoginRequest) GetChallengeOk() (*string, bool) { // HasChallenge returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasChallenge() bool { - if o != nil && o.Challenge != nil { + if o != nil && !IsNil(o.Challenge) { return true } @@ -117,7 +120,7 @@ func (o *OAuth2LoginRequest) SetChallenge(v string) { // GetClient returns the Client field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetClient() OAuth2Client { - if o == nil || o.Client == nil { + if o == nil || IsNil(o.Client) { var ret OAuth2Client return ret } @@ -127,7 +130,7 @@ func (o *OAuth2LoginRequest) GetClient() OAuth2Client { // GetClientOk returns a tuple with the Client field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetClientOk() (*OAuth2Client, bool) { - if o == nil || o.Client == nil { + if o == nil || IsNil(o.Client) { return nil, false } return o.Client, true @@ -135,7 +138,7 @@ func (o *OAuth2LoginRequest) GetClientOk() (*OAuth2Client, bool) { // HasClient returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasClient() bool { - if o != nil && o.Client != nil { + if o != nil && !IsNil(o.Client) { return true } @@ -149,7 +152,7 @@ func (o *OAuth2LoginRequest) SetClient(v OAuth2Client) { // GetOidcContext returns the OidcContext field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetOidcContext() OAuth2ConsentRequestOpenIDConnectContext { - if o == nil || o.OidcContext == nil { + if o == nil || IsNil(o.OidcContext) { var ret OAuth2ConsentRequestOpenIDConnectContext return ret } @@ -159,7 +162,7 @@ func (o *OAuth2LoginRequest) GetOidcContext() OAuth2ConsentRequestOpenIDConnectC // GetOidcContextOk returns a tuple with the OidcContext field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetOidcContextOk() (*OAuth2ConsentRequestOpenIDConnectContext, bool) { - if o == nil || o.OidcContext == nil { + if o == nil || IsNil(o.OidcContext) { return nil, false } return o.OidcContext, true @@ -167,7 +170,7 @@ func (o *OAuth2LoginRequest) GetOidcContextOk() (*OAuth2ConsentRequestOpenIDConn // HasOidcContext returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasOidcContext() bool { - if o != nil && o.OidcContext != nil { + if o != nil && !IsNil(o.OidcContext) { return true } @@ -181,7 +184,7 @@ func (o *OAuth2LoginRequest) SetOidcContext(v OAuth2ConsentRequestOpenIDConnectC // GetRequestUrl returns the RequestUrl field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetRequestUrl() string { - if o == nil || o.RequestUrl == nil { + if o == nil || IsNil(o.RequestUrl) { var ret string return ret } @@ -191,7 +194,7 @@ func (o *OAuth2LoginRequest) GetRequestUrl() string { // GetRequestUrlOk returns a tuple with the RequestUrl field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetRequestUrlOk() (*string, bool) { - if o == nil || o.RequestUrl == nil { + if o == nil || IsNil(o.RequestUrl) { return nil, false } return o.RequestUrl, true @@ -199,7 +202,7 @@ func (o *OAuth2LoginRequest) GetRequestUrlOk() (*string, bool) { // HasRequestUrl returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasRequestUrl() bool { - if o != nil && o.RequestUrl != nil { + if o != nil && !IsNil(o.RequestUrl) { return true } @@ -213,7 +216,7 @@ func (o *OAuth2LoginRequest) SetRequestUrl(v string) { // GetRequestedAccessTokenAudience returns the RequestedAccessTokenAudience field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetRequestedAccessTokenAudience() []string { - if o == nil || o.RequestedAccessTokenAudience == nil { + if o == nil || IsNil(o.RequestedAccessTokenAudience) { var ret []string return ret } @@ -223,7 +226,7 @@ func (o *OAuth2LoginRequest) GetRequestedAccessTokenAudience() []string { // GetRequestedAccessTokenAudienceOk returns a tuple with the RequestedAccessTokenAudience field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetRequestedAccessTokenAudienceOk() ([]string, bool) { - if o == nil || o.RequestedAccessTokenAudience == nil { + if o == nil || IsNil(o.RequestedAccessTokenAudience) { return nil, false } return o.RequestedAccessTokenAudience, true @@ -231,7 +234,7 @@ func (o *OAuth2LoginRequest) GetRequestedAccessTokenAudienceOk() ([]string, bool // HasRequestedAccessTokenAudience returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasRequestedAccessTokenAudience() bool { - if o != nil && o.RequestedAccessTokenAudience != nil { + if o != nil && !IsNil(o.RequestedAccessTokenAudience) { return true } @@ -245,7 +248,7 @@ func (o *OAuth2LoginRequest) SetRequestedAccessTokenAudience(v []string) { // GetRequestedScope returns the RequestedScope field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetRequestedScope() []string { - if o == nil || o.RequestedScope == nil { + if o == nil || IsNil(o.RequestedScope) { var ret []string return ret } @@ -255,7 +258,7 @@ func (o *OAuth2LoginRequest) GetRequestedScope() []string { // GetRequestedScopeOk returns a tuple with the RequestedScope field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetRequestedScopeOk() ([]string, bool) { - if o == nil || o.RequestedScope == nil { + if o == nil || IsNil(o.RequestedScope) { return nil, false } return o.RequestedScope, true @@ -263,7 +266,7 @@ func (o *OAuth2LoginRequest) GetRequestedScopeOk() ([]string, bool) { // HasRequestedScope returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasRequestedScope() bool { - if o != nil && o.RequestedScope != nil { + if o != nil && !IsNil(o.RequestedScope) { return true } @@ -277,7 +280,7 @@ func (o *OAuth2LoginRequest) SetRequestedScope(v []string) { // GetSessionId returns the SessionId field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetSessionId() string { - if o == nil || o.SessionId == nil { + if o == nil || IsNil(o.SessionId) { var ret string return ret } @@ -287,7 +290,7 @@ func (o *OAuth2LoginRequest) GetSessionId() string { // GetSessionIdOk returns a tuple with the SessionId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetSessionIdOk() (*string, bool) { - if o == nil || o.SessionId == nil { + if o == nil || IsNil(o.SessionId) { return nil, false } return o.SessionId, true @@ -295,7 +298,7 @@ func (o *OAuth2LoginRequest) GetSessionIdOk() (*string, bool) { // HasSessionId returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasSessionId() bool { - if o != nil && o.SessionId != nil { + if o != nil && !IsNil(o.SessionId) { return true } @@ -309,7 +312,7 @@ func (o *OAuth2LoginRequest) SetSessionId(v string) { // GetSkip returns the Skip field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetSkip() bool { - if o == nil || o.Skip == nil { + if o == nil || IsNil(o.Skip) { var ret bool return ret } @@ -319,7 +322,7 @@ func (o *OAuth2LoginRequest) GetSkip() bool { // GetSkipOk returns a tuple with the Skip field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetSkipOk() (*bool, bool) { - if o == nil || o.Skip == nil { + if o == nil || IsNil(o.Skip) { return nil, false } return o.Skip, true @@ -327,7 +330,7 @@ func (o *OAuth2LoginRequest) GetSkipOk() (*bool, bool) { // HasSkip returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasSkip() bool { - if o != nil && o.Skip != nil { + if o != nil && !IsNil(o.Skip) { return true } @@ -341,7 +344,7 @@ func (o *OAuth2LoginRequest) SetSkip(v bool) { // GetSubject returns the Subject field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetSubject() string { - if o == nil || o.Subject == nil { + if o == nil || IsNil(o.Subject) { var ret string return ret } @@ -351,7 +354,7 @@ func (o *OAuth2LoginRequest) GetSubject() string { // GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetSubjectOk() (*string, bool) { - if o == nil || o.Subject == nil { + if o == nil || IsNil(o.Subject) { return nil, false } return o.Subject, true @@ -359,7 +362,7 @@ func (o *OAuth2LoginRequest) GetSubjectOk() (*string, bool) { // HasSubject returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasSubject() bool { - if o != nil && o.Subject != nil { + if o != nil && !IsNil(o.Subject) { return true } @@ -372,38 +375,46 @@ func (o *OAuth2LoginRequest) SetSubject(v string) { } func (o OAuth2LoginRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OAuth2LoginRequest) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.AdditionalPropertiesField != nil { + if !IsNil(o.AdditionalPropertiesField) { toSerialize["AdditionalProperties"] = o.AdditionalPropertiesField } - if o.Challenge != nil { + if !IsNil(o.Challenge) { toSerialize["challenge"] = o.Challenge } - if o.Client != nil { + if !IsNil(o.Client) { toSerialize["client"] = o.Client } - if o.OidcContext != nil { + if !IsNil(o.OidcContext) { toSerialize["oidc_context"] = o.OidcContext } - if o.RequestUrl != nil { + if !IsNil(o.RequestUrl) { toSerialize["request_url"] = o.RequestUrl } - if o.RequestedAccessTokenAudience != nil { + if !IsNil(o.RequestedAccessTokenAudience) { toSerialize["requested_access_token_audience"] = o.RequestedAccessTokenAudience } - if o.RequestedScope != nil { + if !IsNil(o.RequestedScope) { toSerialize["requested_scope"] = o.RequestedScope } - if o.SessionId != nil { + if !IsNil(o.SessionId) { toSerialize["session_id"] = o.SessionId } - if o.Skip != nil { + if !IsNil(o.Skip) { toSerialize["skip"] = o.Skip } - if o.Subject != nil { + if !IsNil(o.Subject) { toSerialize["subject"] = o.Subject } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableOAuth2LoginRequest struct { diff --git a/internal/client-go/model_patch_identities_body.go b/internal/client-go/model_patch_identities_body.go index 01ea4833c924..91930e65b743 100644 --- a/internal/client-go/model_patch_identities_body.go +++ b/internal/client-go/model_patch_identities_body.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the PatchIdentitiesBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchIdentitiesBody{} + // PatchIdentitiesBody Patch Identities Body type PatchIdentitiesBody struct { // Identities holds the list of patches to apply required @@ -40,7 +43,7 @@ func NewPatchIdentitiesBodyWithDefaults() *PatchIdentitiesBody { // GetIdentities returns the Identities field value if set, zero value otherwise. func (o *PatchIdentitiesBody) GetIdentities() []IdentityPatch { - if o == nil || o.Identities == nil { + if o == nil || IsNil(o.Identities) { var ret []IdentityPatch return ret } @@ -50,7 +53,7 @@ func (o *PatchIdentitiesBody) GetIdentities() []IdentityPatch { // GetIdentitiesOk returns a tuple with the Identities field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PatchIdentitiesBody) GetIdentitiesOk() ([]IdentityPatch, bool) { - if o == nil || o.Identities == nil { + if o == nil || IsNil(o.Identities) { return nil, false } return o.Identities, true @@ -58,7 +61,7 @@ func (o *PatchIdentitiesBody) GetIdentitiesOk() ([]IdentityPatch, bool) { // HasIdentities returns a boolean if a field has been set. func (o *PatchIdentitiesBody) HasIdentities() bool { - if o != nil && o.Identities != nil { + if o != nil && !IsNil(o.Identities) { return true } @@ -71,11 +74,19 @@ func (o *PatchIdentitiesBody) SetIdentities(v []IdentityPatch) { } func (o PatchIdentitiesBody) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PatchIdentitiesBody) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Identities != nil { + if !IsNil(o.Identities) { toSerialize["identities"] = o.Identities } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullablePatchIdentitiesBody struct { diff --git a/internal/client-go/model_perform_native_logout_body.go b/internal/client-go/model_perform_native_logout_body.go index 81d65f11a7c1..d62372095eef 100644 --- a/internal/client-go/model_perform_native_logout_body.go +++ b/internal/client-go/model_perform_native_logout_body.go @@ -1,26 +1,33 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the PerformNativeLogoutBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PerformNativeLogoutBody{} + // PerformNativeLogoutBody Perform Native Logout Request Body type PerformNativeLogoutBody struct { // The Session Token Invalidate this session token. SessionToken string `json:"session_token"` } +type _PerformNativeLogoutBody PerformNativeLogoutBody + // NewPerformNativeLogoutBody instantiates a new PerformNativeLogoutBody object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -64,13 +71,56 @@ func (o *PerformNativeLogoutBody) SetSessionToken(v string) { } func (o PerformNativeLogoutBody) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["session_token"] = o.SessionToken + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } return json.Marshal(toSerialize) } +func (o PerformNativeLogoutBody) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["session_token"] = o.SessionToken + return toSerialize, nil +} + +func (o *PerformNativeLogoutBody) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "session_token", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varPerformNativeLogoutBody := _PerformNativeLogoutBody{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varPerformNativeLogoutBody) + + if err != nil { + return err + } + + *o = PerformNativeLogoutBody(varPerformNativeLogoutBody) + + return err +} + type NullablePerformNativeLogoutBody struct { value *PerformNativeLogoutBody isSet bool diff --git a/internal/client-go/model_recovery_code_for_identity.go b/internal/client-go/model_recovery_code_for_identity.go index a5027e7c882e..79a5ec375ec0 100644 --- a/internal/client-go/model_recovery_code_for_identity.go +++ b/internal/client-go/model_recovery_code_for_identity.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the RecoveryCodeForIdentity type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RecoveryCodeForIdentity{} + // RecoveryCodeForIdentity Used when an administrator creates a recovery code for an identity. type RecoveryCodeForIdentity struct { // Expires At is the timestamp of when the recovery flow expires The timestamp when the recovery code expires. @@ -26,6 +31,8 @@ type RecoveryCodeForIdentity struct { RecoveryLink string `json:"recovery_link"` } +type _RecoveryCodeForIdentity RecoveryCodeForIdentity + // NewRecoveryCodeForIdentity instantiates a new RecoveryCodeForIdentity object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -47,7 +54,7 @@ func NewRecoveryCodeForIdentityWithDefaults() *RecoveryCodeForIdentity { // GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. func (o *RecoveryCodeForIdentity) GetExpiresAt() time.Time { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { var ret time.Time return ret } @@ -57,7 +64,7 @@ func (o *RecoveryCodeForIdentity) GetExpiresAt() time.Time { // GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryCodeForIdentity) GetExpiresAtOk() (*time.Time, bool) { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { return nil, false } return o.ExpiresAt, true @@ -65,7 +72,7 @@ func (o *RecoveryCodeForIdentity) GetExpiresAtOk() (*time.Time, bool) { // HasExpiresAt returns a boolean if a field has been set. func (o *RecoveryCodeForIdentity) HasExpiresAt() bool { - if o != nil && o.ExpiresAt != nil { + if o != nil && !IsNil(o.ExpiresAt) { return true } @@ -126,17 +133,59 @@ func (o *RecoveryCodeForIdentity) SetRecoveryLink(v string) { } func (o RecoveryCodeForIdentity) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RecoveryCodeForIdentity) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.ExpiresAt != nil { + if !IsNil(o.ExpiresAt) { toSerialize["expires_at"] = o.ExpiresAt } - if true { - toSerialize["recovery_code"] = o.RecoveryCode + toSerialize["recovery_code"] = o.RecoveryCode + toSerialize["recovery_link"] = o.RecoveryLink + return toSerialize, nil +} + +func (o *RecoveryCodeForIdentity) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "recovery_code", + "recovery_link", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["recovery_link"] = o.RecoveryLink + + varRecoveryCodeForIdentity := _RecoveryCodeForIdentity{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRecoveryCodeForIdentity) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = RecoveryCodeForIdentity(varRecoveryCodeForIdentity) + + return err } type NullableRecoveryCodeForIdentity struct { diff --git a/internal/client-go/model_recovery_flow.go b/internal/client-go/model_recovery_flow.go index e6df63a7c6b2..b24a6a610eaf 100644 --- a/internal/client-go/model_recovery_flow.go +++ b/internal/client-go/model_recovery_flow.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the RecoveryFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RecoveryFlow{} + // RecoveryFlow This request is used when an identity wants to recover their account. We recommend reading the [Account Recovery Documentation](../self-service/flows/password-reset-account-recovery) type RecoveryFlow struct { // Active, if set, contains the recovery method that is being used. It is initially not set. @@ -39,6 +44,8 @@ type RecoveryFlow struct { Ui UiContainer `json:"ui"` } +type _RecoveryFlow RecoveryFlow + // NewRecoveryFlow instantiates a new RecoveryFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -65,7 +72,7 @@ func NewRecoveryFlowWithDefaults() *RecoveryFlow { // GetActive returns the Active field value if set, zero value otherwise. func (o *RecoveryFlow) GetActive() string { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { var ret string return ret } @@ -75,7 +82,7 @@ func (o *RecoveryFlow) GetActive() string { // GetActiveOk returns a tuple with the Active field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryFlow) GetActiveOk() (*string, bool) { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { return nil, false } return o.Active, true @@ -83,7 +90,7 @@ func (o *RecoveryFlow) GetActiveOk() (*string, bool) { // HasActive returns a boolean if a field has been set. func (o *RecoveryFlow) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } @@ -97,7 +104,7 @@ func (o *RecoveryFlow) SetActive(v string) { // GetContinueWith returns the ContinueWith field value if set, zero value otherwise. func (o *RecoveryFlow) GetContinueWith() []ContinueWith { - if o == nil || o.ContinueWith == nil { + if o == nil || IsNil(o.ContinueWith) { var ret []ContinueWith return ret } @@ -107,7 +114,7 @@ func (o *RecoveryFlow) GetContinueWith() []ContinueWith { // GetContinueWithOk returns a tuple with the ContinueWith field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryFlow) GetContinueWithOk() ([]ContinueWith, bool) { - if o == nil || o.ContinueWith == nil { + if o == nil || IsNil(o.ContinueWith) { return nil, false } return o.ContinueWith, true @@ -115,7 +122,7 @@ func (o *RecoveryFlow) GetContinueWithOk() ([]ContinueWith, bool) { // HasContinueWith returns a boolean if a field has been set. func (o *RecoveryFlow) HasContinueWith() bool { - if o != nil && o.ContinueWith != nil { + if o != nil && !IsNil(o.ContinueWith) { return true } @@ -225,7 +232,7 @@ func (o *RecoveryFlow) SetRequestUrl(v string) { // GetReturnTo returns the ReturnTo field value if set, zero value otherwise. func (o *RecoveryFlow) GetReturnTo() string { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { var ret string return ret } @@ -235,7 +242,7 @@ func (o *RecoveryFlow) GetReturnTo() string { // GetReturnToOk returns a tuple with the ReturnTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryFlow) GetReturnToOk() (*string, bool) { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { return nil, false } return o.ReturnTo, true @@ -243,7 +250,7 @@ func (o *RecoveryFlow) GetReturnToOk() (*string, bool) { // HasReturnTo returns a boolean if a field has been set. func (o *RecoveryFlow) HasReturnTo() bool { - if o != nil && o.ReturnTo != nil { + if o != nil && !IsNil(o.ReturnTo) { return true } @@ -270,7 +277,7 @@ func (o *RecoveryFlow) GetState() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *RecoveryFlow) GetStateOk() (*interface{}, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return &o.State, true @@ -330,38 +337,77 @@ func (o *RecoveryFlow) SetUi(v UiContainer) { } func (o RecoveryFlow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RecoveryFlow) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - if o.ContinueWith != nil { + if !IsNil(o.ContinueWith) { toSerialize["continue_with"] = o.ContinueWith } - if true { - toSerialize["expires_at"] = o.ExpiresAt - } - if true { - toSerialize["id"] = o.Id - } - if true { - toSerialize["issued_at"] = o.IssuedAt - } - if true { - toSerialize["request_url"] = o.RequestUrl - } - if o.ReturnTo != nil { + toSerialize["expires_at"] = o.ExpiresAt + toSerialize["id"] = o.Id + toSerialize["issued_at"] = o.IssuedAt + toSerialize["request_url"] = o.RequestUrl + if !IsNil(o.ReturnTo) { toSerialize["return_to"] = o.ReturnTo } if o.State != nil { toSerialize["state"] = o.State } - if true { - toSerialize["type"] = o.Type + toSerialize["type"] = o.Type + toSerialize["ui"] = o.Ui + return toSerialize, nil +} + +func (o *RecoveryFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "expires_at", + "id", + "issued_at", + "request_url", + "state", + "type", + "ui", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["ui"] = o.Ui + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varRecoveryFlow := _RecoveryFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRecoveryFlow) + + if err != nil { + return err + } + + *o = RecoveryFlow(varRecoveryFlow) + + return err } type NullableRecoveryFlow struct { diff --git a/internal/client-go/model_recovery_flow_state.go b/internal/client-go/model_recovery_flow_state.go index 1c660ba043b9..12bac3edb7f9 100644 --- a/internal/client-go/model_recovery_flow_state.go +++ b/internal/client-go/model_recovery_flow_state.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -26,6 +26,13 @@ const ( RECOVERYFLOWSTATE_PASSED_CHALLENGE RecoveryFlowState = "passed_challenge" ) +// All allowed values of RecoveryFlowState enum +var AllowedRecoveryFlowStateEnumValues = []RecoveryFlowState{ + "choose_method", + "sent_email", + "passed_challenge", +} + func (v *RecoveryFlowState) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -33,7 +40,7 @@ func (v *RecoveryFlowState) UnmarshalJSON(src []byte) error { return err } enumTypeValue := RecoveryFlowState(value) - for _, existing := range []RecoveryFlowState{"choose_method", "sent_email", "passed_challenge"} { + for _, existing := range AllowedRecoveryFlowStateEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -43,6 +50,27 @@ func (v *RecoveryFlowState) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid RecoveryFlowState", value) } +// NewRecoveryFlowStateFromValue returns a pointer to a valid RecoveryFlowState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRecoveryFlowStateFromValue(v string) (*RecoveryFlowState, error) { + ev := RecoveryFlowState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for RecoveryFlowState: valid values are %v", v, AllowedRecoveryFlowStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v RecoveryFlowState) IsValid() bool { + for _, existing := range AllowedRecoveryFlowStateEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to recoveryFlowState value func (v RecoveryFlowState) Ptr() *RecoveryFlowState { return &v diff --git a/internal/client-go/model_recovery_identity_address.go b/internal/client-go/model_recovery_identity_address.go index 8247f3533794..3750b6a62491 100644 --- a/internal/client-go/model_recovery_identity_address.go +++ b/internal/client-go/model_recovery_identity_address.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the RecoveryIdentityAddress type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RecoveryIdentityAddress{} + // RecoveryIdentityAddress struct for RecoveryIdentityAddress type RecoveryIdentityAddress struct { // CreatedAt is a helper struct field for gobuffalo.pop. @@ -27,6 +32,8 @@ type RecoveryIdentityAddress struct { Via string `json:"via"` } +type _RecoveryIdentityAddress RecoveryIdentityAddress + // NewRecoveryIdentityAddress instantiates a new RecoveryIdentityAddress object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -49,7 +56,7 @@ func NewRecoveryIdentityAddressWithDefaults() *RecoveryIdentityAddress { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *RecoveryIdentityAddress) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -59,7 +66,7 @@ func (o *RecoveryIdentityAddress) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryIdentityAddress) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -67,7 +74,7 @@ func (o *RecoveryIdentityAddress) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *RecoveryIdentityAddress) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -105,7 +112,7 @@ func (o *RecoveryIdentityAddress) SetId(v string) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *RecoveryIdentityAddress) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -115,7 +122,7 @@ func (o *RecoveryIdentityAddress) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryIdentityAddress) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -123,7 +130,7 @@ func (o *RecoveryIdentityAddress) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *RecoveryIdentityAddress) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -184,23 +191,64 @@ func (o *RecoveryIdentityAddress) SetVia(v string) { } func (o RecoveryIdentityAddress) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RecoveryIdentityAddress) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if true { - toSerialize["id"] = o.Id - } - if o.UpdatedAt != nil { + toSerialize["id"] = o.Id + if !IsNil(o.UpdatedAt) { toSerialize["updated_at"] = o.UpdatedAt } - if true { - toSerialize["value"] = o.Value + toSerialize["value"] = o.Value + toSerialize["via"] = o.Via + return toSerialize, nil +} + +func (o *RecoveryIdentityAddress) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "value", + "via", } - if true { - toSerialize["via"] = o.Via + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varRecoveryIdentityAddress := _RecoveryIdentityAddress{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRecoveryIdentityAddress) + + if err != nil { + return err + } + + *o = RecoveryIdentityAddress(varRecoveryIdentityAddress) + + return err } type NullableRecoveryIdentityAddress struct { diff --git a/internal/client-go/model_recovery_link_for_identity.go b/internal/client-go/model_recovery_link_for_identity.go index 2694706eabae..46693ffc49a7 100644 --- a/internal/client-go/model_recovery_link_for_identity.go +++ b/internal/client-go/model_recovery_link_for_identity.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the RecoveryLinkForIdentity type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RecoveryLinkForIdentity{} + // RecoveryLinkForIdentity Used when an administrator creates a recovery link for an identity. type RecoveryLinkForIdentity struct { // Recovery Link Expires At The timestamp when the recovery link expires. @@ -24,6 +29,8 @@ type RecoveryLinkForIdentity struct { RecoveryLink string `json:"recovery_link"` } +type _RecoveryLinkForIdentity RecoveryLinkForIdentity + // NewRecoveryLinkForIdentity instantiates a new RecoveryLinkForIdentity object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -44,7 +51,7 @@ func NewRecoveryLinkForIdentityWithDefaults() *RecoveryLinkForIdentity { // GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. func (o *RecoveryLinkForIdentity) GetExpiresAt() time.Time { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { var ret time.Time return ret } @@ -54,7 +61,7 @@ func (o *RecoveryLinkForIdentity) GetExpiresAt() time.Time { // GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryLinkForIdentity) GetExpiresAtOk() (*time.Time, bool) { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { return nil, false } return o.ExpiresAt, true @@ -62,7 +69,7 @@ func (o *RecoveryLinkForIdentity) GetExpiresAtOk() (*time.Time, bool) { // HasExpiresAt returns a boolean if a field has been set. func (o *RecoveryLinkForIdentity) HasExpiresAt() bool { - if o != nil && o.ExpiresAt != nil { + if o != nil && !IsNil(o.ExpiresAt) { return true } @@ -99,14 +106,57 @@ func (o *RecoveryLinkForIdentity) SetRecoveryLink(v string) { } func (o RecoveryLinkForIdentity) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RecoveryLinkForIdentity) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.ExpiresAt != nil { + if !IsNil(o.ExpiresAt) { toSerialize["expires_at"] = o.ExpiresAt } - if true { - toSerialize["recovery_link"] = o.RecoveryLink + toSerialize["recovery_link"] = o.RecoveryLink + return toSerialize, nil +} + +func (o *RecoveryLinkForIdentity) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "recovery_link", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varRecoveryLinkForIdentity := _RecoveryLinkForIdentity{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRecoveryLinkForIdentity) + + if err != nil { + return err + } + + *o = RecoveryLinkForIdentity(varRecoveryLinkForIdentity) + + return err } type NullableRecoveryLinkForIdentity struct { diff --git a/internal/client-go/model_registration_flow.go b/internal/client-go/model_registration_flow.go index 71ab2c03ebe2..acc8dc749b8c 100644 --- a/internal/client-go/model_registration_flow.go +++ b/internal/client-go/model_registration_flow.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the RegistrationFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RegistrationFlow{} + // RegistrationFlow struct for RegistrationFlow type RegistrationFlow struct { // Active, if set, contains the registration method that is being used. It is initially not set. password CredentialsTypePassword oidc CredentialsTypeOIDC totp CredentialsTypeTOTP lookup_secret CredentialsTypeLookup webauthn CredentialsTypeWebAuthn code CredentialsTypeCodeAuth link_recovery CredentialsTypeRecoveryLink CredentialsTypeRecoveryLink is a special credential type linked to the link strategy (recovery flow). It is not used within the credentials object itself. code_recovery CredentialsTypeRecoveryCode @@ -45,6 +50,8 @@ type RegistrationFlow struct { Ui UiContainer `json:"ui"` } +type _RegistrationFlow RegistrationFlow + // NewRegistrationFlow instantiates a new RegistrationFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -71,7 +78,7 @@ func NewRegistrationFlowWithDefaults() *RegistrationFlow { // GetActive returns the Active field value if set, zero value otherwise. func (o *RegistrationFlow) GetActive() string { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { var ret string return ret } @@ -81,7 +88,7 @@ func (o *RegistrationFlow) GetActive() string { // GetActiveOk returns a tuple with the Active field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RegistrationFlow) GetActiveOk() (*string, bool) { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { return nil, false } return o.Active, true @@ -89,7 +96,7 @@ func (o *RegistrationFlow) GetActiveOk() (*string, bool) { // HasActive returns a boolean if a field has been set. func (o *RegistrationFlow) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } @@ -175,7 +182,7 @@ func (o *RegistrationFlow) SetIssuedAt(v time.Time) { // GetOauth2LoginChallenge returns the Oauth2LoginChallenge field value if set, zero value otherwise. func (o *RegistrationFlow) GetOauth2LoginChallenge() string { - if o == nil || o.Oauth2LoginChallenge == nil { + if o == nil || IsNil(o.Oauth2LoginChallenge) { var ret string return ret } @@ -185,7 +192,7 @@ func (o *RegistrationFlow) GetOauth2LoginChallenge() string { // GetOauth2LoginChallengeOk returns a tuple with the Oauth2LoginChallenge field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RegistrationFlow) GetOauth2LoginChallengeOk() (*string, bool) { - if o == nil || o.Oauth2LoginChallenge == nil { + if o == nil || IsNil(o.Oauth2LoginChallenge) { return nil, false } return o.Oauth2LoginChallenge, true @@ -193,7 +200,7 @@ func (o *RegistrationFlow) GetOauth2LoginChallengeOk() (*string, bool) { // HasOauth2LoginChallenge returns a boolean if a field has been set. func (o *RegistrationFlow) HasOauth2LoginChallenge() bool { - if o != nil && o.Oauth2LoginChallenge != nil { + if o != nil && !IsNil(o.Oauth2LoginChallenge) { return true } @@ -207,7 +214,7 @@ func (o *RegistrationFlow) SetOauth2LoginChallenge(v string) { // GetOauth2LoginRequest returns the Oauth2LoginRequest field value if set, zero value otherwise. func (o *RegistrationFlow) GetOauth2LoginRequest() OAuth2LoginRequest { - if o == nil || o.Oauth2LoginRequest == nil { + if o == nil || IsNil(o.Oauth2LoginRequest) { var ret OAuth2LoginRequest return ret } @@ -217,7 +224,7 @@ func (o *RegistrationFlow) GetOauth2LoginRequest() OAuth2LoginRequest { // GetOauth2LoginRequestOk returns a tuple with the Oauth2LoginRequest field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RegistrationFlow) GetOauth2LoginRequestOk() (*OAuth2LoginRequest, bool) { - if o == nil || o.Oauth2LoginRequest == nil { + if o == nil || IsNil(o.Oauth2LoginRequest) { return nil, false } return o.Oauth2LoginRequest, true @@ -225,7 +232,7 @@ func (o *RegistrationFlow) GetOauth2LoginRequestOk() (*OAuth2LoginRequest, bool) // HasOauth2LoginRequest returns a boolean if a field has been set. func (o *RegistrationFlow) HasOauth2LoginRequest() bool { - if o != nil && o.Oauth2LoginRequest != nil { + if o != nil && !IsNil(o.Oauth2LoginRequest) { return true } @@ -239,7 +246,7 @@ func (o *RegistrationFlow) SetOauth2LoginRequest(v OAuth2LoginRequest) { // GetOrganizationId returns the OrganizationId field value if set, zero value otherwise (both if not set or set to explicit null). func (o *RegistrationFlow) GetOrganizationId() string { - if o == nil || o.OrganizationId.Get() == nil { + if o == nil || IsNil(o.OrganizationId.Get()) { var ret string return ret } @@ -306,7 +313,7 @@ func (o *RegistrationFlow) SetRequestUrl(v string) { // GetReturnTo returns the ReturnTo field value if set, zero value otherwise. func (o *RegistrationFlow) GetReturnTo() string { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { var ret string return ret } @@ -316,7 +323,7 @@ func (o *RegistrationFlow) GetReturnTo() string { // GetReturnToOk returns a tuple with the ReturnTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RegistrationFlow) GetReturnToOk() (*string, bool) { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { return nil, false } return o.ReturnTo, true @@ -324,7 +331,7 @@ func (o *RegistrationFlow) GetReturnToOk() (*string, bool) { // HasReturnTo returns a boolean if a field has been set. func (o *RegistrationFlow) HasReturnTo() bool { - if o != nil && o.ReturnTo != nil { + if o != nil && !IsNil(o.ReturnTo) { return true } @@ -338,7 +345,7 @@ func (o *RegistrationFlow) SetReturnTo(v string) { // GetSessionTokenExchangeCode returns the SessionTokenExchangeCode field value if set, zero value otherwise. func (o *RegistrationFlow) GetSessionTokenExchangeCode() string { - if o == nil || o.SessionTokenExchangeCode == nil { + if o == nil || IsNil(o.SessionTokenExchangeCode) { var ret string return ret } @@ -348,7 +355,7 @@ func (o *RegistrationFlow) GetSessionTokenExchangeCode() string { // GetSessionTokenExchangeCodeOk returns a tuple with the SessionTokenExchangeCode field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RegistrationFlow) GetSessionTokenExchangeCodeOk() (*string, bool) { - if o == nil || o.SessionTokenExchangeCode == nil { + if o == nil || IsNil(o.SessionTokenExchangeCode) { return nil, false } return o.SessionTokenExchangeCode, true @@ -356,7 +363,7 @@ func (o *RegistrationFlow) GetSessionTokenExchangeCodeOk() (*string, bool) { // HasSessionTokenExchangeCode returns a boolean if a field has been set. func (o *RegistrationFlow) HasSessionTokenExchangeCode() bool { - if o != nil && o.SessionTokenExchangeCode != nil { + if o != nil && !IsNil(o.SessionTokenExchangeCode) { return true } @@ -383,7 +390,7 @@ func (o *RegistrationFlow) GetState() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *RegistrationFlow) GetStateOk() (*interface{}, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return &o.State, true @@ -396,7 +403,7 @@ func (o *RegistrationFlow) SetState(v interface{}) { // GetTransientPayload returns the TransientPayload field value if set, zero value otherwise. func (o *RegistrationFlow) GetTransientPayload() map[string]interface{} { - if o == nil || o.TransientPayload == nil { + if o == nil || IsNil(o.TransientPayload) { var ret map[string]interface{} return ret } @@ -406,15 +413,15 @@ func (o *RegistrationFlow) GetTransientPayload() map[string]interface{} { // GetTransientPayloadOk returns a tuple with the TransientPayload field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RegistrationFlow) GetTransientPayloadOk() (map[string]interface{}, bool) { - if o == nil || o.TransientPayload == nil { - return nil, false + if o == nil || IsNil(o.TransientPayload) { + return map[string]interface{}{}, false } return o.TransientPayload, true } // HasTransientPayload returns a boolean if a field has been set. func (o *RegistrationFlow) HasTransientPayload() bool { - if o != nil && o.TransientPayload != nil { + if o != nil && !IsNil(o.TransientPayload) { return true } @@ -475,50 +482,89 @@ func (o *RegistrationFlow) SetUi(v UiContainer) { } func (o RegistrationFlow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RegistrationFlow) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - if true { - toSerialize["expires_at"] = o.ExpiresAt - } - if true { - toSerialize["id"] = o.Id - } - if true { - toSerialize["issued_at"] = o.IssuedAt - } - if o.Oauth2LoginChallenge != nil { + toSerialize["expires_at"] = o.ExpiresAt + toSerialize["id"] = o.Id + toSerialize["issued_at"] = o.IssuedAt + if !IsNil(o.Oauth2LoginChallenge) { toSerialize["oauth2_login_challenge"] = o.Oauth2LoginChallenge } - if o.Oauth2LoginRequest != nil { + if !IsNil(o.Oauth2LoginRequest) { toSerialize["oauth2_login_request"] = o.Oauth2LoginRequest } if o.OrganizationId.IsSet() { toSerialize["organization_id"] = o.OrganizationId.Get() } - if true { - toSerialize["request_url"] = o.RequestUrl - } - if o.ReturnTo != nil { + toSerialize["request_url"] = o.RequestUrl + if !IsNil(o.ReturnTo) { toSerialize["return_to"] = o.ReturnTo } - if o.SessionTokenExchangeCode != nil { + if !IsNil(o.SessionTokenExchangeCode) { toSerialize["session_token_exchange_code"] = o.SessionTokenExchangeCode } if o.State != nil { toSerialize["state"] = o.State } - if o.TransientPayload != nil { + if !IsNil(o.TransientPayload) { toSerialize["transient_payload"] = o.TransientPayload } - if true { - toSerialize["type"] = o.Type + toSerialize["type"] = o.Type + toSerialize["ui"] = o.Ui + return toSerialize, nil +} + +func (o *RegistrationFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "expires_at", + "id", + "issued_at", + "request_url", + "state", + "type", + "ui", } - if true { - toSerialize["ui"] = o.Ui + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varRegistrationFlow := _RegistrationFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRegistrationFlow) + + if err != nil { + return err + } + + *o = RegistrationFlow(varRegistrationFlow) + + return err } type NullableRegistrationFlow struct { diff --git a/internal/client-go/model_registration_flow_state.go b/internal/client-go/model_registration_flow_state.go index 86f3fd38cff0..23bf897aace5 100644 --- a/internal/client-go/model_registration_flow_state.go +++ b/internal/client-go/model_registration_flow_state.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -26,6 +26,13 @@ const ( REGISTRATIONFLOWSTATE_PASSED_CHALLENGE RegistrationFlowState = "passed_challenge" ) +// All allowed values of RegistrationFlowState enum +var AllowedRegistrationFlowStateEnumValues = []RegistrationFlowState{ + "choose_method", + "sent_email", + "passed_challenge", +} + func (v *RegistrationFlowState) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -33,7 +40,7 @@ func (v *RegistrationFlowState) UnmarshalJSON(src []byte) error { return err } enumTypeValue := RegistrationFlowState(value) - for _, existing := range []RegistrationFlowState{"choose_method", "sent_email", "passed_challenge"} { + for _, existing := range AllowedRegistrationFlowStateEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -43,6 +50,27 @@ func (v *RegistrationFlowState) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid RegistrationFlowState", value) } +// NewRegistrationFlowStateFromValue returns a pointer to a valid RegistrationFlowState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRegistrationFlowStateFromValue(v string) (*RegistrationFlowState, error) { + ev := RegistrationFlowState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for RegistrationFlowState: valid values are %v", v, AllowedRegistrationFlowStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v RegistrationFlowState) IsValid() bool { + for _, existing := range AllowedRegistrationFlowStateEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to registrationFlowState value func (v RegistrationFlowState) Ptr() *RegistrationFlowState { return &v diff --git a/internal/client-go/model_self_service_flow_expired_error.go b/internal/client-go/model_self_service_flow_expired_error.go index a84737381a2d..c369e75d78a1 100644 --- a/internal/client-go/model_self_service_flow_expired_error.go +++ b/internal/client-go/model_self_service_flow_expired_error.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -16,6 +16,9 @@ import ( "time" ) +// checks if the SelfServiceFlowExpiredError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SelfServiceFlowExpiredError{} + // SelfServiceFlowExpiredError Is sent when a flow is expired type SelfServiceFlowExpiredError struct { Error *GenericError `json:"error,omitempty"` @@ -46,7 +49,7 @@ func NewSelfServiceFlowExpiredErrorWithDefaults() *SelfServiceFlowExpiredError { // GetError returns the Error field value if set, zero value otherwise. func (o *SelfServiceFlowExpiredError) GetError() GenericError { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret GenericError return ret } @@ -56,7 +59,7 @@ func (o *SelfServiceFlowExpiredError) GetError() GenericError { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SelfServiceFlowExpiredError) GetErrorOk() (*GenericError, bool) { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { return nil, false } return o.Error, true @@ -64,7 +67,7 @@ func (o *SelfServiceFlowExpiredError) GetErrorOk() (*GenericError, bool) { // HasError returns a boolean if a field has been set. func (o *SelfServiceFlowExpiredError) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -78,7 +81,7 @@ func (o *SelfServiceFlowExpiredError) SetError(v GenericError) { // GetExpiredAt returns the ExpiredAt field value if set, zero value otherwise. func (o *SelfServiceFlowExpiredError) GetExpiredAt() time.Time { - if o == nil || o.ExpiredAt == nil { + if o == nil || IsNil(o.ExpiredAt) { var ret time.Time return ret } @@ -88,7 +91,7 @@ func (o *SelfServiceFlowExpiredError) GetExpiredAt() time.Time { // GetExpiredAtOk returns a tuple with the ExpiredAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SelfServiceFlowExpiredError) GetExpiredAtOk() (*time.Time, bool) { - if o == nil || o.ExpiredAt == nil { + if o == nil || IsNil(o.ExpiredAt) { return nil, false } return o.ExpiredAt, true @@ -96,7 +99,7 @@ func (o *SelfServiceFlowExpiredError) GetExpiredAtOk() (*time.Time, bool) { // HasExpiredAt returns a boolean if a field has been set. func (o *SelfServiceFlowExpiredError) HasExpiredAt() bool { - if o != nil && o.ExpiredAt != nil { + if o != nil && !IsNil(o.ExpiredAt) { return true } @@ -110,7 +113,7 @@ func (o *SelfServiceFlowExpiredError) SetExpiredAt(v time.Time) { // GetSince returns the Since field value if set, zero value otherwise. func (o *SelfServiceFlowExpiredError) GetSince() int64 { - if o == nil || o.Since == nil { + if o == nil || IsNil(o.Since) { var ret int64 return ret } @@ -120,7 +123,7 @@ func (o *SelfServiceFlowExpiredError) GetSince() int64 { // GetSinceOk returns a tuple with the Since field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SelfServiceFlowExpiredError) GetSinceOk() (*int64, bool) { - if o == nil || o.Since == nil { + if o == nil || IsNil(o.Since) { return nil, false } return o.Since, true @@ -128,7 +131,7 @@ func (o *SelfServiceFlowExpiredError) GetSinceOk() (*int64, bool) { // HasSince returns a boolean if a field has been set. func (o *SelfServiceFlowExpiredError) HasSince() bool { - if o != nil && o.Since != nil { + if o != nil && !IsNil(o.Since) { return true } @@ -142,7 +145,7 @@ func (o *SelfServiceFlowExpiredError) SetSince(v int64) { // GetUseFlowId returns the UseFlowId field value if set, zero value otherwise. func (o *SelfServiceFlowExpiredError) GetUseFlowId() string { - if o == nil || o.UseFlowId == nil { + if o == nil || IsNil(o.UseFlowId) { var ret string return ret } @@ -152,7 +155,7 @@ func (o *SelfServiceFlowExpiredError) GetUseFlowId() string { // GetUseFlowIdOk returns a tuple with the UseFlowId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SelfServiceFlowExpiredError) GetUseFlowIdOk() (*string, bool) { - if o == nil || o.UseFlowId == nil { + if o == nil || IsNil(o.UseFlowId) { return nil, false } return o.UseFlowId, true @@ -160,7 +163,7 @@ func (o *SelfServiceFlowExpiredError) GetUseFlowIdOk() (*string, bool) { // HasUseFlowId returns a boolean if a field has been set. func (o *SelfServiceFlowExpiredError) HasUseFlowId() bool { - if o != nil && o.UseFlowId != nil { + if o != nil && !IsNil(o.UseFlowId) { return true } @@ -173,20 +176,28 @@ func (o *SelfServiceFlowExpiredError) SetUseFlowId(v string) { } func (o SelfServiceFlowExpiredError) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SelfServiceFlowExpiredError) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Error != nil { + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if o.ExpiredAt != nil { + if !IsNil(o.ExpiredAt) { toSerialize["expired_at"] = o.ExpiredAt } - if o.Since != nil { + if !IsNil(o.Since) { toSerialize["since"] = o.Since } - if o.UseFlowId != nil { + if !IsNil(o.UseFlowId) { toSerialize["use_flow_id"] = o.UseFlowId } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableSelfServiceFlowExpiredError struct { diff --git a/internal/client-go/model_session.go b/internal/client-go/model_session.go index aa10a1dac55c..8e66537e374e 100644 --- a/internal/client-go/model_session.go +++ b/internal/client-go/model_session.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the Session type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Session{} + // Session A Session type Session struct { // Active state. If false the session is no longer active. @@ -38,6 +43,8 @@ type Session struct { Tokenized *string `json:"tokenized,omitempty"` } +type _Session Session + // NewSession instantiates a new Session object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -58,7 +65,7 @@ func NewSessionWithDefaults() *Session { // GetActive returns the Active field value if set, zero value otherwise. func (o *Session) GetActive() bool { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { var ret bool return ret } @@ -68,7 +75,7 @@ func (o *Session) GetActive() bool { // GetActiveOk returns a tuple with the Active field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetActiveOk() (*bool, bool) { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { return nil, false } return o.Active, true @@ -76,7 +83,7 @@ func (o *Session) GetActiveOk() (*bool, bool) { // HasActive returns a boolean if a field has been set. func (o *Session) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } @@ -90,7 +97,7 @@ func (o *Session) SetActive(v bool) { // GetAuthenticatedAt returns the AuthenticatedAt field value if set, zero value otherwise. func (o *Session) GetAuthenticatedAt() time.Time { - if o == nil || o.AuthenticatedAt == nil { + if o == nil || IsNil(o.AuthenticatedAt) { var ret time.Time return ret } @@ -100,7 +107,7 @@ func (o *Session) GetAuthenticatedAt() time.Time { // GetAuthenticatedAtOk returns a tuple with the AuthenticatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetAuthenticatedAtOk() (*time.Time, bool) { - if o == nil || o.AuthenticatedAt == nil { + if o == nil || IsNil(o.AuthenticatedAt) { return nil, false } return o.AuthenticatedAt, true @@ -108,7 +115,7 @@ func (o *Session) GetAuthenticatedAtOk() (*time.Time, bool) { // HasAuthenticatedAt returns a boolean if a field has been set. func (o *Session) HasAuthenticatedAt() bool { - if o != nil && o.AuthenticatedAt != nil { + if o != nil && !IsNil(o.AuthenticatedAt) { return true } @@ -122,7 +129,7 @@ func (o *Session) SetAuthenticatedAt(v time.Time) { // GetAuthenticationMethods returns the AuthenticationMethods field value if set, zero value otherwise. func (o *Session) GetAuthenticationMethods() []SessionAuthenticationMethod { - if o == nil || o.AuthenticationMethods == nil { + if o == nil || IsNil(o.AuthenticationMethods) { var ret []SessionAuthenticationMethod return ret } @@ -132,7 +139,7 @@ func (o *Session) GetAuthenticationMethods() []SessionAuthenticationMethod { // GetAuthenticationMethodsOk returns a tuple with the AuthenticationMethods field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetAuthenticationMethodsOk() ([]SessionAuthenticationMethod, bool) { - if o == nil || o.AuthenticationMethods == nil { + if o == nil || IsNil(o.AuthenticationMethods) { return nil, false } return o.AuthenticationMethods, true @@ -140,7 +147,7 @@ func (o *Session) GetAuthenticationMethodsOk() ([]SessionAuthenticationMethod, b // HasAuthenticationMethods returns a boolean if a field has been set. func (o *Session) HasAuthenticationMethods() bool { - if o != nil && o.AuthenticationMethods != nil { + if o != nil && !IsNil(o.AuthenticationMethods) { return true } @@ -154,7 +161,7 @@ func (o *Session) SetAuthenticationMethods(v []SessionAuthenticationMethod) { // GetAuthenticatorAssuranceLevel returns the AuthenticatorAssuranceLevel field value if set, zero value otherwise. func (o *Session) GetAuthenticatorAssuranceLevel() AuthenticatorAssuranceLevel { - if o == nil || o.AuthenticatorAssuranceLevel == nil { + if o == nil || IsNil(o.AuthenticatorAssuranceLevel) { var ret AuthenticatorAssuranceLevel return ret } @@ -164,7 +171,7 @@ func (o *Session) GetAuthenticatorAssuranceLevel() AuthenticatorAssuranceLevel { // GetAuthenticatorAssuranceLevelOk returns a tuple with the AuthenticatorAssuranceLevel field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetAuthenticatorAssuranceLevelOk() (*AuthenticatorAssuranceLevel, bool) { - if o == nil || o.AuthenticatorAssuranceLevel == nil { + if o == nil || IsNil(o.AuthenticatorAssuranceLevel) { return nil, false } return o.AuthenticatorAssuranceLevel, true @@ -172,7 +179,7 @@ func (o *Session) GetAuthenticatorAssuranceLevelOk() (*AuthenticatorAssuranceLev // HasAuthenticatorAssuranceLevel returns a boolean if a field has been set. func (o *Session) HasAuthenticatorAssuranceLevel() bool { - if o != nil && o.AuthenticatorAssuranceLevel != nil { + if o != nil && !IsNil(o.AuthenticatorAssuranceLevel) { return true } @@ -186,7 +193,7 @@ func (o *Session) SetAuthenticatorAssuranceLevel(v AuthenticatorAssuranceLevel) // GetDevices returns the Devices field value if set, zero value otherwise. func (o *Session) GetDevices() []SessionDevice { - if o == nil || o.Devices == nil { + if o == nil || IsNil(o.Devices) { var ret []SessionDevice return ret } @@ -196,7 +203,7 @@ func (o *Session) GetDevices() []SessionDevice { // GetDevicesOk returns a tuple with the Devices field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetDevicesOk() ([]SessionDevice, bool) { - if o == nil || o.Devices == nil { + if o == nil || IsNil(o.Devices) { return nil, false } return o.Devices, true @@ -204,7 +211,7 @@ func (o *Session) GetDevicesOk() ([]SessionDevice, bool) { // HasDevices returns a boolean if a field has been set. func (o *Session) HasDevices() bool { - if o != nil && o.Devices != nil { + if o != nil && !IsNil(o.Devices) { return true } @@ -218,7 +225,7 @@ func (o *Session) SetDevices(v []SessionDevice) { // GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. func (o *Session) GetExpiresAt() time.Time { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { var ret time.Time return ret } @@ -228,7 +235,7 @@ func (o *Session) GetExpiresAt() time.Time { // GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetExpiresAtOk() (*time.Time, bool) { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { return nil, false } return o.ExpiresAt, true @@ -236,7 +243,7 @@ func (o *Session) GetExpiresAtOk() (*time.Time, bool) { // HasExpiresAt returns a boolean if a field has been set. func (o *Session) HasExpiresAt() bool { - if o != nil && o.ExpiresAt != nil { + if o != nil && !IsNil(o.ExpiresAt) { return true } @@ -274,7 +281,7 @@ func (o *Session) SetId(v string) { // GetIdentity returns the Identity field value if set, zero value otherwise. func (o *Session) GetIdentity() Identity { - if o == nil || o.Identity == nil { + if o == nil || IsNil(o.Identity) { var ret Identity return ret } @@ -284,7 +291,7 @@ func (o *Session) GetIdentity() Identity { // GetIdentityOk returns a tuple with the Identity field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetIdentityOk() (*Identity, bool) { - if o == nil || o.Identity == nil { + if o == nil || IsNil(o.Identity) { return nil, false } return o.Identity, true @@ -292,7 +299,7 @@ func (o *Session) GetIdentityOk() (*Identity, bool) { // HasIdentity returns a boolean if a field has been set. func (o *Session) HasIdentity() bool { - if o != nil && o.Identity != nil { + if o != nil && !IsNil(o.Identity) { return true } @@ -306,7 +313,7 @@ func (o *Session) SetIdentity(v Identity) { // GetIssuedAt returns the IssuedAt field value if set, zero value otherwise. func (o *Session) GetIssuedAt() time.Time { - if o == nil || o.IssuedAt == nil { + if o == nil || IsNil(o.IssuedAt) { var ret time.Time return ret } @@ -316,7 +323,7 @@ func (o *Session) GetIssuedAt() time.Time { // GetIssuedAtOk returns a tuple with the IssuedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetIssuedAtOk() (*time.Time, bool) { - if o == nil || o.IssuedAt == nil { + if o == nil || IsNil(o.IssuedAt) { return nil, false } return o.IssuedAt, true @@ -324,7 +331,7 @@ func (o *Session) GetIssuedAtOk() (*time.Time, bool) { // HasIssuedAt returns a boolean if a field has been set. func (o *Session) HasIssuedAt() bool { - if o != nil && o.IssuedAt != nil { + if o != nil && !IsNil(o.IssuedAt) { return true } @@ -338,7 +345,7 @@ func (o *Session) SetIssuedAt(v time.Time) { // GetTokenized returns the Tokenized field value if set, zero value otherwise. func (o *Session) GetTokenized() string { - if o == nil || o.Tokenized == nil { + if o == nil || IsNil(o.Tokenized) { var ret string return ret } @@ -348,7 +355,7 @@ func (o *Session) GetTokenized() string { // GetTokenizedOk returns a tuple with the Tokenized field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetTokenizedOk() (*string, bool) { - if o == nil || o.Tokenized == nil { + if o == nil || IsNil(o.Tokenized) { return nil, false } return o.Tokenized, true @@ -356,7 +363,7 @@ func (o *Session) GetTokenizedOk() (*string, bool) { // HasTokenized returns a boolean if a field has been set. func (o *Session) HasTokenized() bool { - if o != nil && o.Tokenized != nil { + if o != nil && !IsNil(o.Tokenized) { return true } @@ -369,38 +376,81 @@ func (o *Session) SetTokenized(v string) { } func (o Session) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Session) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - if o.AuthenticatedAt != nil { + if !IsNil(o.AuthenticatedAt) { toSerialize["authenticated_at"] = o.AuthenticatedAt } - if o.AuthenticationMethods != nil { + if !IsNil(o.AuthenticationMethods) { toSerialize["authentication_methods"] = o.AuthenticationMethods } - if o.AuthenticatorAssuranceLevel != nil { + if !IsNil(o.AuthenticatorAssuranceLevel) { toSerialize["authenticator_assurance_level"] = o.AuthenticatorAssuranceLevel } - if o.Devices != nil { + if !IsNil(o.Devices) { toSerialize["devices"] = o.Devices } - if o.ExpiresAt != nil { + if !IsNil(o.ExpiresAt) { toSerialize["expires_at"] = o.ExpiresAt } - if true { - toSerialize["id"] = o.Id - } - if o.Identity != nil { + toSerialize["id"] = o.Id + if !IsNil(o.Identity) { toSerialize["identity"] = o.Identity } - if o.IssuedAt != nil { + if !IsNil(o.IssuedAt) { toSerialize["issued_at"] = o.IssuedAt } - if o.Tokenized != nil { + if !IsNil(o.Tokenized) { toSerialize["tokenized"] = o.Tokenized } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *Session) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSession := _Session{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSession) + + if err != nil { + return err + } + + *o = Session(varSession) + + return err } type NullableSession struct { diff --git a/internal/client-go/model_session_authentication_method.go b/internal/client-go/model_session_authentication_method.go index 17228de93141..4d5010f1acef 100644 --- a/internal/client-go/model_session_authentication_method.go +++ b/internal/client-go/model_session_authentication_method.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -16,6 +16,9 @@ import ( "time" ) +// checks if the SessionAuthenticationMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SessionAuthenticationMethod{} + // SessionAuthenticationMethod A singular authenticator used during authentication / login. type SessionAuthenticationMethod struct { Aal *AuthenticatorAssuranceLevel `json:"aal,omitempty"` @@ -47,7 +50,7 @@ func NewSessionAuthenticationMethodWithDefaults() *SessionAuthenticationMethod { // GetAal returns the Aal field value if set, zero value otherwise. func (o *SessionAuthenticationMethod) GetAal() AuthenticatorAssuranceLevel { - if o == nil || o.Aal == nil { + if o == nil || IsNil(o.Aal) { var ret AuthenticatorAssuranceLevel return ret } @@ -57,7 +60,7 @@ func (o *SessionAuthenticationMethod) GetAal() AuthenticatorAssuranceLevel { // GetAalOk returns a tuple with the Aal field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionAuthenticationMethod) GetAalOk() (*AuthenticatorAssuranceLevel, bool) { - if o == nil || o.Aal == nil { + if o == nil || IsNil(o.Aal) { return nil, false } return o.Aal, true @@ -65,7 +68,7 @@ func (o *SessionAuthenticationMethod) GetAalOk() (*AuthenticatorAssuranceLevel, // HasAal returns a boolean if a field has been set. func (o *SessionAuthenticationMethod) HasAal() bool { - if o != nil && o.Aal != nil { + if o != nil && !IsNil(o.Aal) { return true } @@ -79,7 +82,7 @@ func (o *SessionAuthenticationMethod) SetAal(v AuthenticatorAssuranceLevel) { // GetCompletedAt returns the CompletedAt field value if set, zero value otherwise. func (o *SessionAuthenticationMethod) GetCompletedAt() time.Time { - if o == nil || o.CompletedAt == nil { + if o == nil || IsNil(o.CompletedAt) { var ret time.Time return ret } @@ -89,7 +92,7 @@ func (o *SessionAuthenticationMethod) GetCompletedAt() time.Time { // GetCompletedAtOk returns a tuple with the CompletedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionAuthenticationMethod) GetCompletedAtOk() (*time.Time, bool) { - if o == nil || o.CompletedAt == nil { + if o == nil || IsNil(o.CompletedAt) { return nil, false } return o.CompletedAt, true @@ -97,7 +100,7 @@ func (o *SessionAuthenticationMethod) GetCompletedAtOk() (*time.Time, bool) { // HasCompletedAt returns a boolean if a field has been set. func (o *SessionAuthenticationMethod) HasCompletedAt() bool { - if o != nil && o.CompletedAt != nil { + if o != nil && !IsNil(o.CompletedAt) { return true } @@ -111,7 +114,7 @@ func (o *SessionAuthenticationMethod) SetCompletedAt(v time.Time) { // GetMethod returns the Method field value if set, zero value otherwise. func (o *SessionAuthenticationMethod) GetMethod() string { - if o == nil || o.Method == nil { + if o == nil || IsNil(o.Method) { var ret string return ret } @@ -121,7 +124,7 @@ func (o *SessionAuthenticationMethod) GetMethod() string { // GetMethodOk returns a tuple with the Method field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionAuthenticationMethod) GetMethodOk() (*string, bool) { - if o == nil || o.Method == nil { + if o == nil || IsNil(o.Method) { return nil, false } return o.Method, true @@ -129,7 +132,7 @@ func (o *SessionAuthenticationMethod) GetMethodOk() (*string, bool) { // HasMethod returns a boolean if a field has been set. func (o *SessionAuthenticationMethod) HasMethod() bool { - if o != nil && o.Method != nil { + if o != nil && !IsNil(o.Method) { return true } @@ -143,7 +146,7 @@ func (o *SessionAuthenticationMethod) SetMethod(v string) { // GetOrganization returns the Organization field value if set, zero value otherwise. func (o *SessionAuthenticationMethod) GetOrganization() string { - if o == nil || o.Organization == nil { + if o == nil || IsNil(o.Organization) { var ret string return ret } @@ -153,7 +156,7 @@ func (o *SessionAuthenticationMethod) GetOrganization() string { // GetOrganizationOk returns a tuple with the Organization field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionAuthenticationMethod) GetOrganizationOk() (*string, bool) { - if o == nil || o.Organization == nil { + if o == nil || IsNil(o.Organization) { return nil, false } return o.Organization, true @@ -161,7 +164,7 @@ func (o *SessionAuthenticationMethod) GetOrganizationOk() (*string, bool) { // HasOrganization returns a boolean if a field has been set. func (o *SessionAuthenticationMethod) HasOrganization() bool { - if o != nil && o.Organization != nil { + if o != nil && !IsNil(o.Organization) { return true } @@ -175,7 +178,7 @@ func (o *SessionAuthenticationMethod) SetOrganization(v string) { // GetProvider returns the Provider field value if set, zero value otherwise. func (o *SessionAuthenticationMethod) GetProvider() string { - if o == nil || o.Provider == nil { + if o == nil || IsNil(o.Provider) { var ret string return ret } @@ -185,7 +188,7 @@ func (o *SessionAuthenticationMethod) GetProvider() string { // GetProviderOk returns a tuple with the Provider field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionAuthenticationMethod) GetProviderOk() (*string, bool) { - if o == nil || o.Provider == nil { + if o == nil || IsNil(o.Provider) { return nil, false } return o.Provider, true @@ -193,7 +196,7 @@ func (o *SessionAuthenticationMethod) GetProviderOk() (*string, bool) { // HasProvider returns a boolean if a field has been set. func (o *SessionAuthenticationMethod) HasProvider() bool { - if o != nil && o.Provider != nil { + if o != nil && !IsNil(o.Provider) { return true } @@ -206,23 +209,31 @@ func (o *SessionAuthenticationMethod) SetProvider(v string) { } func (o SessionAuthenticationMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SessionAuthenticationMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Aal != nil { + if !IsNil(o.Aal) { toSerialize["aal"] = o.Aal } - if o.CompletedAt != nil { + if !IsNil(o.CompletedAt) { toSerialize["completed_at"] = o.CompletedAt } - if o.Method != nil { + if !IsNil(o.Method) { toSerialize["method"] = o.Method } - if o.Organization != nil { + if !IsNil(o.Organization) { toSerialize["organization"] = o.Organization } - if o.Provider != nil { + if !IsNil(o.Provider) { toSerialize["provider"] = o.Provider } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableSessionAuthenticationMethod struct { diff --git a/internal/client-go/model_session_device.go b/internal/client-go/model_session_device.go index 44e79c507dc1..2bb11ea18576 100644 --- a/internal/client-go/model_session_device.go +++ b/internal/client-go/model_session_device.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the SessionDevice type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SessionDevice{} + // SessionDevice Device corresponding to a Session type SessionDevice struct { // Device record ID @@ -27,6 +32,8 @@ type SessionDevice struct { UserAgent *string `json:"user_agent,omitempty"` } +type _SessionDevice SessionDevice + // NewSessionDevice instantiates a new SessionDevice object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -71,7 +78,7 @@ func (o *SessionDevice) SetId(v string) { // GetIpAddress returns the IpAddress field value if set, zero value otherwise. func (o *SessionDevice) GetIpAddress() string { - if o == nil || o.IpAddress == nil { + if o == nil || IsNil(o.IpAddress) { var ret string return ret } @@ -81,7 +88,7 @@ func (o *SessionDevice) GetIpAddress() string { // GetIpAddressOk returns a tuple with the IpAddress field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionDevice) GetIpAddressOk() (*string, bool) { - if o == nil || o.IpAddress == nil { + if o == nil || IsNil(o.IpAddress) { return nil, false } return o.IpAddress, true @@ -89,7 +96,7 @@ func (o *SessionDevice) GetIpAddressOk() (*string, bool) { // HasIpAddress returns a boolean if a field has been set. func (o *SessionDevice) HasIpAddress() bool { - if o != nil && o.IpAddress != nil { + if o != nil && !IsNil(o.IpAddress) { return true } @@ -103,7 +110,7 @@ func (o *SessionDevice) SetIpAddress(v string) { // GetLocation returns the Location field value if set, zero value otherwise. func (o *SessionDevice) GetLocation() string { - if o == nil || o.Location == nil { + if o == nil || IsNil(o.Location) { var ret string return ret } @@ -113,7 +120,7 @@ func (o *SessionDevice) GetLocation() string { // GetLocationOk returns a tuple with the Location field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionDevice) GetLocationOk() (*string, bool) { - if o == nil || o.Location == nil { + if o == nil || IsNil(o.Location) { return nil, false } return o.Location, true @@ -121,7 +128,7 @@ func (o *SessionDevice) GetLocationOk() (*string, bool) { // HasLocation returns a boolean if a field has been set. func (o *SessionDevice) HasLocation() bool { - if o != nil && o.Location != nil { + if o != nil && !IsNil(o.Location) { return true } @@ -135,7 +142,7 @@ func (o *SessionDevice) SetLocation(v string) { // GetUserAgent returns the UserAgent field value if set, zero value otherwise. func (o *SessionDevice) GetUserAgent() string { - if o == nil || o.UserAgent == nil { + if o == nil || IsNil(o.UserAgent) { var ret string return ret } @@ -145,7 +152,7 @@ func (o *SessionDevice) GetUserAgent() string { // GetUserAgentOk returns a tuple with the UserAgent field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionDevice) GetUserAgentOk() (*string, bool) { - if o == nil || o.UserAgent == nil { + if o == nil || IsNil(o.UserAgent) { return nil, false } return o.UserAgent, true @@ -153,7 +160,7 @@ func (o *SessionDevice) GetUserAgentOk() (*string, bool) { // HasUserAgent returns a boolean if a field has been set. func (o *SessionDevice) HasUserAgent() bool { - if o != nil && o.UserAgent != nil { + if o != nil && !IsNil(o.UserAgent) { return true } @@ -166,20 +173,63 @@ func (o *SessionDevice) SetUserAgent(v string) { } func (o SessionDevice) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["id"] = o.Id + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.IpAddress != nil { + return json.Marshal(toSerialize) +} + +func (o SessionDevice) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + if !IsNil(o.IpAddress) { toSerialize["ip_address"] = o.IpAddress } - if o.Location != nil { + if !IsNil(o.Location) { toSerialize["location"] = o.Location } - if o.UserAgent != nil { + if !IsNil(o.UserAgent) { toSerialize["user_agent"] = o.UserAgent } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *SessionDevice) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSessionDevice := _SessionDevice{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSessionDevice) + + if err != nil { + return err + } + + *o = SessionDevice(varSessionDevice) + + return err } type NullableSessionDevice struct { diff --git a/internal/client-go/model_settings_flow.go b/internal/client-go/model_settings_flow.go index fa5cd9317c54..4b07827c0d74 100644 --- a/internal/client-go/model_settings_flow.go +++ b/internal/client-go/model_settings_flow.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the SettingsFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SettingsFlow{} + // SettingsFlow This flow is used when an identity wants to update settings (e.g. profile data, passwords, ...) in a selfservice manner. We recommend reading the [User Settings Documentation](../self-service/flows/user-settings) type SettingsFlow struct { // Active, if set, contains the registration method that is being used. It is initially not set. @@ -40,6 +45,8 @@ type SettingsFlow struct { Ui UiContainer `json:"ui"` } +type _SettingsFlow SettingsFlow + // NewSettingsFlow instantiates a new SettingsFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -67,7 +74,7 @@ func NewSettingsFlowWithDefaults() *SettingsFlow { // GetActive returns the Active field value if set, zero value otherwise. func (o *SettingsFlow) GetActive() string { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { var ret string return ret } @@ -77,7 +84,7 @@ func (o *SettingsFlow) GetActive() string { // GetActiveOk returns a tuple with the Active field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SettingsFlow) GetActiveOk() (*string, bool) { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { return nil, false } return o.Active, true @@ -85,7 +92,7 @@ func (o *SettingsFlow) GetActiveOk() (*string, bool) { // HasActive returns a boolean if a field has been set. func (o *SettingsFlow) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } @@ -99,7 +106,7 @@ func (o *SettingsFlow) SetActive(v string) { // GetContinueWith returns the ContinueWith field value if set, zero value otherwise. func (o *SettingsFlow) GetContinueWith() []ContinueWith { - if o == nil || o.ContinueWith == nil { + if o == nil || IsNil(o.ContinueWith) { var ret []ContinueWith return ret } @@ -109,7 +116,7 @@ func (o *SettingsFlow) GetContinueWith() []ContinueWith { // GetContinueWithOk returns a tuple with the ContinueWith field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SettingsFlow) GetContinueWithOk() ([]ContinueWith, bool) { - if o == nil || o.ContinueWith == nil { + if o == nil || IsNil(o.ContinueWith) { return nil, false } return o.ContinueWith, true @@ -117,7 +124,7 @@ func (o *SettingsFlow) GetContinueWithOk() ([]ContinueWith, bool) { // HasContinueWith returns a boolean if a field has been set. func (o *SettingsFlow) HasContinueWith() bool { - if o != nil && o.ContinueWith != nil { + if o != nil && !IsNil(o.ContinueWith) { return true } @@ -251,7 +258,7 @@ func (o *SettingsFlow) SetRequestUrl(v string) { // GetReturnTo returns the ReturnTo field value if set, zero value otherwise. func (o *SettingsFlow) GetReturnTo() string { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { var ret string return ret } @@ -261,7 +268,7 @@ func (o *SettingsFlow) GetReturnTo() string { // GetReturnToOk returns a tuple with the ReturnTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SettingsFlow) GetReturnToOk() (*string, bool) { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { return nil, false } return o.ReturnTo, true @@ -269,7 +276,7 @@ func (o *SettingsFlow) GetReturnToOk() (*string, bool) { // HasReturnTo returns a boolean if a field has been set. func (o *SettingsFlow) HasReturnTo() bool { - if o != nil && o.ReturnTo != nil { + if o != nil && !IsNil(o.ReturnTo) { return true } @@ -296,7 +303,7 @@ func (o *SettingsFlow) GetState() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *SettingsFlow) GetStateOk() (*interface{}, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return &o.State, true @@ -356,41 +363,79 @@ func (o *SettingsFlow) SetUi(v UiContainer) { } func (o SettingsFlow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SettingsFlow) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - if o.ContinueWith != nil { + if !IsNil(o.ContinueWith) { toSerialize["continue_with"] = o.ContinueWith } - if true { - toSerialize["expires_at"] = o.ExpiresAt - } - if true { - toSerialize["id"] = o.Id - } - if true { - toSerialize["identity"] = o.Identity - } - if true { - toSerialize["issued_at"] = o.IssuedAt - } - if true { - toSerialize["request_url"] = o.RequestUrl - } - if o.ReturnTo != nil { + toSerialize["expires_at"] = o.ExpiresAt + toSerialize["id"] = o.Id + toSerialize["identity"] = o.Identity + toSerialize["issued_at"] = o.IssuedAt + toSerialize["request_url"] = o.RequestUrl + if !IsNil(o.ReturnTo) { toSerialize["return_to"] = o.ReturnTo } if o.State != nil { toSerialize["state"] = o.State } - if true { - toSerialize["type"] = o.Type + toSerialize["type"] = o.Type + toSerialize["ui"] = o.Ui + return toSerialize, nil +} + +func (o *SettingsFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "expires_at", + "id", + "identity", + "issued_at", + "request_url", + "state", + "type", + "ui", } - if true { - toSerialize["ui"] = o.Ui + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSettingsFlow := _SettingsFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSettingsFlow) + + if err != nil { + return err + } + + *o = SettingsFlow(varSettingsFlow) + + return err } type NullableSettingsFlow struct { diff --git a/internal/client-go/model_settings_flow_state.go b/internal/client-go/model_settings_flow_state.go index f994c786a2d8..d180c74d6884 100644 --- a/internal/client-go/model_settings_flow_state.go +++ b/internal/client-go/model_settings_flow_state.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -25,6 +25,12 @@ const ( SETTINGSFLOWSTATE_SUCCESS SettingsFlowState = "success" ) +// All allowed values of SettingsFlowState enum +var AllowedSettingsFlowStateEnumValues = []SettingsFlowState{ + "show_form", + "success", +} + func (v *SettingsFlowState) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -32,7 +38,7 @@ func (v *SettingsFlowState) UnmarshalJSON(src []byte) error { return err } enumTypeValue := SettingsFlowState(value) - for _, existing := range []SettingsFlowState{"show_form", "success"} { + for _, existing := range AllowedSettingsFlowStateEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -42,6 +48,27 @@ func (v *SettingsFlowState) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid SettingsFlowState", value) } +// NewSettingsFlowStateFromValue returns a pointer to a valid SettingsFlowState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSettingsFlowStateFromValue(v string) (*SettingsFlowState, error) { + ev := SettingsFlowState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SettingsFlowState: valid values are %v", v, AllowedSettingsFlowStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SettingsFlowState) IsValid() bool { + for _, existing := range AllowedSettingsFlowStateEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to settingsFlowState value func (v SettingsFlowState) Ptr() *SettingsFlowState { return &v diff --git a/internal/client-go/model_successful_code_exchange_response.go b/internal/client-go/model_successful_code_exchange_response.go index 9defabefefe5..a78f505d8fc1 100644 --- a/internal/client-go/model_successful_code_exchange_response.go +++ b/internal/client-go/model_successful_code_exchange_response.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the SuccessfulCodeExchangeResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SuccessfulCodeExchangeResponse{} + // SuccessfulCodeExchangeResponse The Response for Registration Flows via API type SuccessfulCodeExchangeResponse struct { Session Session `json:"session"` @@ -22,6 +27,8 @@ type SuccessfulCodeExchangeResponse struct { SessionToken *string `json:"session_token,omitempty"` } +type _SuccessfulCodeExchangeResponse SuccessfulCodeExchangeResponse + // NewSuccessfulCodeExchangeResponse instantiates a new SuccessfulCodeExchangeResponse object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -66,7 +73,7 @@ func (o *SuccessfulCodeExchangeResponse) SetSession(v Session) { // GetSessionToken returns the SessionToken field value if set, zero value otherwise. func (o *SuccessfulCodeExchangeResponse) GetSessionToken() string { - if o == nil || o.SessionToken == nil { + if o == nil || IsNil(o.SessionToken) { var ret string return ret } @@ -76,7 +83,7 @@ func (o *SuccessfulCodeExchangeResponse) GetSessionToken() string { // GetSessionTokenOk returns a tuple with the SessionToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SuccessfulCodeExchangeResponse) GetSessionTokenOk() (*string, bool) { - if o == nil || o.SessionToken == nil { + if o == nil || IsNil(o.SessionToken) { return nil, false } return o.SessionToken, true @@ -84,7 +91,7 @@ func (o *SuccessfulCodeExchangeResponse) GetSessionTokenOk() (*string, bool) { // HasSessionToken returns a boolean if a field has been set. func (o *SuccessfulCodeExchangeResponse) HasSessionToken() bool { - if o != nil && o.SessionToken != nil { + if o != nil && !IsNil(o.SessionToken) { return true } @@ -97,14 +104,57 @@ func (o *SuccessfulCodeExchangeResponse) SetSessionToken(v string) { } func (o SuccessfulCodeExchangeResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["session"] = o.Session + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.SessionToken != nil { + return json.Marshal(toSerialize) +} + +func (o SuccessfulCodeExchangeResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["session"] = o.Session + if !IsNil(o.SessionToken) { toSerialize["session_token"] = o.SessionToken } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *SuccessfulCodeExchangeResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "session", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSuccessfulCodeExchangeResponse := _SuccessfulCodeExchangeResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSuccessfulCodeExchangeResponse) + + if err != nil { + return err + } + + *o = SuccessfulCodeExchangeResponse(varSuccessfulCodeExchangeResponse) + + return err } type NullableSuccessfulCodeExchangeResponse struct { diff --git a/internal/client-go/model_successful_native_login.go b/internal/client-go/model_successful_native_login.go index f87739f19d12..d406a3870564 100644 --- a/internal/client-go/model_successful_native_login.go +++ b/internal/client-go/model_successful_native_login.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the SuccessfulNativeLogin type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SuccessfulNativeLogin{} + // SuccessfulNativeLogin The Response for Login Flows via API type SuccessfulNativeLogin struct { Session Session `json:"session"` @@ -22,6 +27,8 @@ type SuccessfulNativeLogin struct { SessionToken *string `json:"session_token,omitempty"` } +type _SuccessfulNativeLogin SuccessfulNativeLogin + // NewSuccessfulNativeLogin instantiates a new SuccessfulNativeLogin object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -66,7 +73,7 @@ func (o *SuccessfulNativeLogin) SetSession(v Session) { // GetSessionToken returns the SessionToken field value if set, zero value otherwise. func (o *SuccessfulNativeLogin) GetSessionToken() string { - if o == nil || o.SessionToken == nil { + if o == nil || IsNil(o.SessionToken) { var ret string return ret } @@ -76,7 +83,7 @@ func (o *SuccessfulNativeLogin) GetSessionToken() string { // GetSessionTokenOk returns a tuple with the SessionToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SuccessfulNativeLogin) GetSessionTokenOk() (*string, bool) { - if o == nil || o.SessionToken == nil { + if o == nil || IsNil(o.SessionToken) { return nil, false } return o.SessionToken, true @@ -84,7 +91,7 @@ func (o *SuccessfulNativeLogin) GetSessionTokenOk() (*string, bool) { // HasSessionToken returns a boolean if a field has been set. func (o *SuccessfulNativeLogin) HasSessionToken() bool { - if o != nil && o.SessionToken != nil { + if o != nil && !IsNil(o.SessionToken) { return true } @@ -97,14 +104,57 @@ func (o *SuccessfulNativeLogin) SetSessionToken(v string) { } func (o SuccessfulNativeLogin) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["session"] = o.Session + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.SessionToken != nil { + return json.Marshal(toSerialize) +} + +func (o SuccessfulNativeLogin) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["session"] = o.Session + if !IsNil(o.SessionToken) { toSerialize["session_token"] = o.SessionToken } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *SuccessfulNativeLogin) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "session", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSuccessfulNativeLogin := _SuccessfulNativeLogin{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSuccessfulNativeLogin) + + if err != nil { + return err + } + + *o = SuccessfulNativeLogin(varSuccessfulNativeLogin) + + return err } type NullableSuccessfulNativeLogin struct { diff --git a/internal/client-go/model_successful_native_registration.go b/internal/client-go/model_successful_native_registration.go index b56cc42bc6e5..98bbba63c0af 100644 --- a/internal/client-go/model_successful_native_registration.go +++ b/internal/client-go/model_successful_native_registration.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the SuccessfulNativeRegistration type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SuccessfulNativeRegistration{} + // SuccessfulNativeRegistration The Response for Registration Flows via API type SuccessfulNativeRegistration struct { // Contains a list of actions, that could follow this flow It can, for example, this will contain a reference to the verification flow, created as part of the user's registration or the token of the session. @@ -25,6 +30,8 @@ type SuccessfulNativeRegistration struct { SessionToken *string `json:"session_token,omitempty"` } +type _SuccessfulNativeRegistration SuccessfulNativeRegistration + // NewSuccessfulNativeRegistration instantiates a new SuccessfulNativeRegistration object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -45,7 +52,7 @@ func NewSuccessfulNativeRegistrationWithDefaults() *SuccessfulNativeRegistration // GetContinueWith returns the ContinueWith field value if set, zero value otherwise. func (o *SuccessfulNativeRegistration) GetContinueWith() []ContinueWith { - if o == nil || o.ContinueWith == nil { + if o == nil || IsNil(o.ContinueWith) { var ret []ContinueWith return ret } @@ -55,7 +62,7 @@ func (o *SuccessfulNativeRegistration) GetContinueWith() []ContinueWith { // GetContinueWithOk returns a tuple with the ContinueWith field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SuccessfulNativeRegistration) GetContinueWithOk() ([]ContinueWith, bool) { - if o == nil || o.ContinueWith == nil { + if o == nil || IsNil(o.ContinueWith) { return nil, false } return o.ContinueWith, true @@ -63,7 +70,7 @@ func (o *SuccessfulNativeRegistration) GetContinueWithOk() ([]ContinueWith, bool // HasContinueWith returns a boolean if a field has been set. func (o *SuccessfulNativeRegistration) HasContinueWith() bool { - if o != nil && o.ContinueWith != nil { + if o != nil && !IsNil(o.ContinueWith) { return true } @@ -101,7 +108,7 @@ func (o *SuccessfulNativeRegistration) SetIdentity(v Identity) { // GetSession returns the Session field value if set, zero value otherwise. func (o *SuccessfulNativeRegistration) GetSession() Session { - if o == nil || o.Session == nil { + if o == nil || IsNil(o.Session) { var ret Session return ret } @@ -111,7 +118,7 @@ func (o *SuccessfulNativeRegistration) GetSession() Session { // GetSessionOk returns a tuple with the Session field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SuccessfulNativeRegistration) GetSessionOk() (*Session, bool) { - if o == nil || o.Session == nil { + if o == nil || IsNil(o.Session) { return nil, false } return o.Session, true @@ -119,7 +126,7 @@ func (o *SuccessfulNativeRegistration) GetSessionOk() (*Session, bool) { // HasSession returns a boolean if a field has been set. func (o *SuccessfulNativeRegistration) HasSession() bool { - if o != nil && o.Session != nil { + if o != nil && !IsNil(o.Session) { return true } @@ -133,7 +140,7 @@ func (o *SuccessfulNativeRegistration) SetSession(v Session) { // GetSessionToken returns the SessionToken field value if set, zero value otherwise. func (o *SuccessfulNativeRegistration) GetSessionToken() string { - if o == nil || o.SessionToken == nil { + if o == nil || IsNil(o.SessionToken) { var ret string return ret } @@ -143,7 +150,7 @@ func (o *SuccessfulNativeRegistration) GetSessionToken() string { // GetSessionTokenOk returns a tuple with the SessionToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SuccessfulNativeRegistration) GetSessionTokenOk() (*string, bool) { - if o == nil || o.SessionToken == nil { + if o == nil || IsNil(o.SessionToken) { return nil, false } return o.SessionToken, true @@ -151,7 +158,7 @@ func (o *SuccessfulNativeRegistration) GetSessionTokenOk() (*string, bool) { // HasSessionToken returns a boolean if a field has been set. func (o *SuccessfulNativeRegistration) HasSessionToken() bool { - if o != nil && o.SessionToken != nil { + if o != nil && !IsNil(o.SessionToken) { return true } @@ -164,20 +171,63 @@ func (o *SuccessfulNativeRegistration) SetSessionToken(v string) { } func (o SuccessfulNativeRegistration) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SuccessfulNativeRegistration) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.ContinueWith != nil { + if !IsNil(o.ContinueWith) { toSerialize["continue_with"] = o.ContinueWith } - if true { - toSerialize["identity"] = o.Identity - } - if o.Session != nil { + toSerialize["identity"] = o.Identity + if !IsNil(o.Session) { toSerialize["session"] = o.Session } - if o.SessionToken != nil { + if !IsNil(o.SessionToken) { toSerialize["session_token"] = o.SessionToken } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *SuccessfulNativeRegistration) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "identity", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSuccessfulNativeRegistration := _SuccessfulNativeRegistration{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSuccessfulNativeRegistration) + + if err != nil { + return err + } + + *o = SuccessfulNativeRegistration(varSuccessfulNativeRegistration) + + return err } type NullableSuccessfulNativeRegistration struct { diff --git a/internal/client-go/model_token_pagination.go b/internal/client-go/model_token_pagination.go index b8422dd14242..84427921066a 100644 --- a/internal/client-go/model_token_pagination.go +++ b/internal/client-go/model_token_pagination.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the TokenPagination type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TokenPagination{} + // TokenPagination struct for TokenPagination type TokenPagination struct { // Items per page This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). @@ -50,7 +53,7 @@ func NewTokenPaginationWithDefaults() *TokenPagination { // GetPageSize returns the PageSize field value if set, zero value otherwise. func (o *TokenPagination) GetPageSize() int64 { - if o == nil || o.PageSize == nil { + if o == nil || IsNil(o.PageSize) { var ret int64 return ret } @@ -60,7 +63,7 @@ func (o *TokenPagination) GetPageSize() int64 { // GetPageSizeOk returns a tuple with the PageSize field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *TokenPagination) GetPageSizeOk() (*int64, bool) { - if o == nil || o.PageSize == nil { + if o == nil || IsNil(o.PageSize) { return nil, false } return o.PageSize, true @@ -68,7 +71,7 @@ func (o *TokenPagination) GetPageSizeOk() (*int64, bool) { // HasPageSize returns a boolean if a field has been set. func (o *TokenPagination) HasPageSize() bool { - if o != nil && o.PageSize != nil { + if o != nil && !IsNil(o.PageSize) { return true } @@ -82,7 +85,7 @@ func (o *TokenPagination) SetPageSize(v int64) { // GetPageToken returns the PageToken field value if set, zero value otherwise. func (o *TokenPagination) GetPageToken() string { - if o == nil || o.PageToken == nil { + if o == nil || IsNil(o.PageToken) { var ret string return ret } @@ -92,7 +95,7 @@ func (o *TokenPagination) GetPageToken() string { // GetPageTokenOk returns a tuple with the PageToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *TokenPagination) GetPageTokenOk() (*string, bool) { - if o == nil || o.PageToken == nil { + if o == nil || IsNil(o.PageToken) { return nil, false } return o.PageToken, true @@ -100,7 +103,7 @@ func (o *TokenPagination) GetPageTokenOk() (*string, bool) { // HasPageToken returns a boolean if a field has been set. func (o *TokenPagination) HasPageToken() bool { - if o != nil && o.PageToken != nil { + if o != nil && !IsNil(o.PageToken) { return true } @@ -113,14 +116,22 @@ func (o *TokenPagination) SetPageToken(v string) { } func (o TokenPagination) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TokenPagination) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.PageSize != nil { + if !IsNil(o.PageSize) { toSerialize["page_size"] = o.PageSize } - if o.PageToken != nil { + if !IsNil(o.PageToken) { toSerialize["page_token"] = o.PageToken } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableTokenPagination struct { diff --git a/internal/client-go/model_token_pagination_headers.go b/internal/client-go/model_token_pagination_headers.go index 00e0b840f124..592227e56b36 100644 --- a/internal/client-go/model_token_pagination_headers.go +++ b/internal/client-go/model_token_pagination_headers.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the TokenPaginationHeaders type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TokenPaginationHeaders{} + // TokenPaginationHeaders struct for TokenPaginationHeaders type TokenPaginationHeaders struct { // The link header contains pagination links. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). in: header @@ -42,7 +45,7 @@ func NewTokenPaginationHeadersWithDefaults() *TokenPaginationHeaders { // GetLink returns the Link field value if set, zero value otherwise. func (o *TokenPaginationHeaders) GetLink() string { - if o == nil || o.Link == nil { + if o == nil || IsNil(o.Link) { var ret string return ret } @@ -52,7 +55,7 @@ func (o *TokenPaginationHeaders) GetLink() string { // GetLinkOk returns a tuple with the Link field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *TokenPaginationHeaders) GetLinkOk() (*string, bool) { - if o == nil || o.Link == nil { + if o == nil || IsNil(o.Link) { return nil, false } return o.Link, true @@ -60,7 +63,7 @@ func (o *TokenPaginationHeaders) GetLinkOk() (*string, bool) { // HasLink returns a boolean if a field has been set. func (o *TokenPaginationHeaders) HasLink() bool { - if o != nil && o.Link != nil { + if o != nil && !IsNil(o.Link) { return true } @@ -74,7 +77,7 @@ func (o *TokenPaginationHeaders) SetLink(v string) { // GetXTotalCount returns the XTotalCount field value if set, zero value otherwise. func (o *TokenPaginationHeaders) GetXTotalCount() string { - if o == nil || o.XTotalCount == nil { + if o == nil || IsNil(o.XTotalCount) { var ret string return ret } @@ -84,7 +87,7 @@ func (o *TokenPaginationHeaders) GetXTotalCount() string { // GetXTotalCountOk returns a tuple with the XTotalCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *TokenPaginationHeaders) GetXTotalCountOk() (*string, bool) { - if o == nil || o.XTotalCount == nil { + if o == nil || IsNil(o.XTotalCount) { return nil, false } return o.XTotalCount, true @@ -92,7 +95,7 @@ func (o *TokenPaginationHeaders) GetXTotalCountOk() (*string, bool) { // HasXTotalCount returns a boolean if a field has been set. func (o *TokenPaginationHeaders) HasXTotalCount() bool { - if o != nil && o.XTotalCount != nil { + if o != nil && !IsNil(o.XTotalCount) { return true } @@ -105,14 +108,22 @@ func (o *TokenPaginationHeaders) SetXTotalCount(v string) { } func (o TokenPaginationHeaders) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TokenPaginationHeaders) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Link != nil { + if !IsNil(o.Link) { toSerialize["link"] = o.Link } - if o.XTotalCount != nil { + if !IsNil(o.XTotalCount) { toSerialize["x-total-count"] = o.XTotalCount } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableTokenPaginationHeaders struct { diff --git a/internal/client-go/model_ui_container.go b/internal/client-go/model_ui_container.go index 10ffd75ea4a2..bc799d0dede1 100644 --- a/internal/client-go/model_ui_container.go +++ b/internal/client-go/model_ui_container.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiContainer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiContainer{} + // UiContainer Container represents a HTML Form. The container can work with both HTTP Form and JSON requests type UiContainer struct { // Action should be used as the form action URL `
`. @@ -25,6 +30,8 @@ type UiContainer struct { Nodes []UiNode `json:"nodes"` } +type _UiContainer UiContainer + // NewUiContainer instantiates a new UiContainer object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -71,7 +78,7 @@ func (o *UiContainer) SetAction(v string) { // GetMessages returns the Messages field value if set, zero value otherwise. func (o *UiContainer) GetMessages() []UiText { - if o == nil || o.Messages == nil { + if o == nil || IsNil(o.Messages) { var ret []UiText return ret } @@ -81,7 +88,7 @@ func (o *UiContainer) GetMessages() []UiText { // GetMessagesOk returns a tuple with the Messages field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiContainer) GetMessagesOk() ([]UiText, bool) { - if o == nil || o.Messages == nil { + if o == nil || IsNil(o.Messages) { return nil, false } return o.Messages, true @@ -89,7 +96,7 @@ func (o *UiContainer) GetMessagesOk() ([]UiText, bool) { // HasMessages returns a boolean if a field has been set. func (o *UiContainer) HasMessages() bool { - if o != nil && o.Messages != nil { + if o != nil && !IsNil(o.Messages) { return true } @@ -150,20 +157,61 @@ func (o *UiContainer) SetNodes(v []UiNode) { } func (o UiContainer) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["action"] = o.Action + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Messages != nil { + return json.Marshal(toSerialize) +} + +func (o UiContainer) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["action"] = o.Action + if !IsNil(o.Messages) { toSerialize["messages"] = o.Messages } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + toSerialize["nodes"] = o.Nodes + return toSerialize, nil +} + +func (o *UiContainer) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "action", + "method", + "nodes", } - if true { - toSerialize["nodes"] = o.Nodes + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUiContainer := _UiContainer{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiContainer) + + if err != nil { + return err + } + + *o = UiContainer(varUiContainer) + + return err } type NullableUiContainer struct { diff --git a/internal/client-go/model_ui_node.go b/internal/client-go/model_ui_node.go index ca88879a7414..4ca9b3ab7204 100644 --- a/internal/client-go/model_ui_node.go +++ b/internal/client-go/model_ui_node.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiNode type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNode{} + // UiNode Nodes are represented as HTML elements or their native UI equivalents. For example, a node can be an `` tag, or an `` but also `some plain text`. type UiNode struct { Attributes UiNodeAttributes `json:"attributes"` @@ -26,6 +31,8 @@ type UiNode struct { Type string `json:"type"` } +type _UiNode UiNode + // NewUiNode instantiates a new UiNode object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -169,23 +176,62 @@ func (o *UiNode) SetType(v string) { } func (o UiNode) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["attributes"] = o.Attributes + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if true { - toSerialize["group"] = o.Group + return json.Marshal(toSerialize) +} + +func (o UiNode) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["attributes"] = o.Attributes + toSerialize["group"] = o.Group + toSerialize["messages"] = o.Messages + toSerialize["meta"] = o.Meta + toSerialize["type"] = o.Type + return toSerialize, nil +} + +func (o *UiNode) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "attributes", + "group", + "messages", + "meta", + "type", } - if true { - toSerialize["messages"] = o.Messages + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["meta"] = o.Meta + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["type"] = o.Type + + varUiNode := _UiNode{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiNode) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UiNode(varUiNode) + + return err } type NullableUiNode struct { diff --git a/internal/client-go/model_ui_node_anchor_attributes.go b/internal/client-go/model_ui_node_anchor_attributes.go index 15cb492fe8eb..4f70bdb1a073 100644 --- a/internal/client-go/model_ui_node_anchor_attributes.go +++ b/internal/client-go/model_ui_node_anchor_attributes.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiNodeAnchorAttributes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNodeAnchorAttributes{} + // UiNodeAnchorAttributes struct for UiNodeAnchorAttributes type UiNodeAnchorAttributes struct { // The link's href (destination) URL. format: uri @@ -26,6 +31,8 @@ type UiNodeAnchorAttributes struct { Title UiText `json:"title"` } +type _UiNodeAnchorAttributes UiNodeAnchorAttributes + // NewUiNodeAnchorAttributes instantiates a new UiNodeAnchorAttributes object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -144,20 +151,60 @@ func (o *UiNodeAnchorAttributes) SetTitle(v UiText) { } func (o UiNodeAnchorAttributes) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UiNodeAnchorAttributes) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["href"] = o.Href + toSerialize["href"] = o.Href + toSerialize["id"] = o.Id + toSerialize["node_type"] = o.NodeType + toSerialize["title"] = o.Title + return toSerialize, nil +} + +func (o *UiNodeAnchorAttributes) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "href", + "id", + "node_type", + "title", } - if true { - toSerialize["id"] = o.Id + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["node_type"] = o.NodeType + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["title"] = o.Title + + varUiNodeAnchorAttributes := _UiNodeAnchorAttributes{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiNodeAnchorAttributes) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UiNodeAnchorAttributes(varUiNodeAnchorAttributes) + + return err } type NullableUiNodeAnchorAttributes struct { diff --git a/internal/client-go/model_ui_node_attributes.go b/internal/client-go/model_ui_node_attributes.go index 347be6f44a72..4869fae58a4f 100644 --- a/internal/client-go/model_ui_node_attributes.go +++ b/internal/client-go/model_ui_node_attributes.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -137,11 +137,11 @@ func (dst *UiNodeAttributes) UnmarshalJSON(data []byte) error { dst.UiNodeScriptAttributes = nil dst.UiNodeTextAttributes = nil - return fmt.Errorf("Data matches more than one schema in oneOf(UiNodeAttributes)") + return fmt.Errorf("data matches more than one schema in oneOf(UiNodeAttributes)") } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(UiNodeAttributes)") + return fmt.Errorf("data failed to match schemas in oneOf(UiNodeAttributes)") } } diff --git a/internal/client-go/model_ui_node_image_attributes.go b/internal/client-go/model_ui_node_image_attributes.go index 5b300b9548bd..f5e07582e692 100644 --- a/internal/client-go/model_ui_node_image_attributes.go +++ b/internal/client-go/model_ui_node_image_attributes.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiNodeImageAttributes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNodeImageAttributes{} + // UiNodeImageAttributes struct for UiNodeImageAttributes type UiNodeImageAttributes struct { // Height of the image @@ -29,6 +34,8 @@ type UiNodeImageAttributes struct { Width int64 `json:"width"` } +type _UiNodeImageAttributes UiNodeImageAttributes + // NewUiNodeImageAttributes instantiates a new UiNodeImageAttributes object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -172,23 +179,62 @@ func (o *UiNodeImageAttributes) SetWidth(v int64) { } func (o UiNodeImageAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["height"] = o.Height + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if true { - toSerialize["id"] = o.Id + return json.Marshal(toSerialize) +} + +func (o UiNodeImageAttributes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["height"] = o.Height + toSerialize["id"] = o.Id + toSerialize["node_type"] = o.NodeType + toSerialize["src"] = o.Src + toSerialize["width"] = o.Width + return toSerialize, nil +} + +func (o *UiNodeImageAttributes) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "height", + "id", + "node_type", + "src", + "width", } - if true { - toSerialize["node_type"] = o.NodeType + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["src"] = o.Src + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["width"] = o.Width + + varUiNodeImageAttributes := _UiNodeImageAttributes{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiNodeImageAttributes) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UiNodeImageAttributes(varUiNodeImageAttributes) + + return err } type NullableUiNodeImageAttributes struct { diff --git a/internal/client-go/model_ui_node_input_attributes.go b/internal/client-go/model_ui_node_input_attributes.go index 285456f2af98..3d3ff8b9b584 100644 --- a/internal/client-go/model_ui_node_input_attributes.go +++ b/internal/client-go/model_ui_node_input_attributes.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiNodeInputAttributes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNodeInputAttributes{} + // UiNodeInputAttributes InputAttributes represents the attributes of an input node type UiNodeInputAttributes struct { // The autocomplete attribute for the input. email InputAttributeAutocompleteEmail tel InputAttributeAutocompleteTel url InputAttributeAutocompleteUrl current-password InputAttributeAutocompleteCurrentPassword new-password InputAttributeAutocompleteNewPassword one-time-code InputAttributeAutocompleteOneTimeCode @@ -38,6 +43,8 @@ type UiNodeInputAttributes struct { Value interface{} `json:"value,omitempty"` } +type _UiNodeInputAttributes UiNodeInputAttributes + // NewUiNodeInputAttributes instantiates a new UiNodeInputAttributes object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -61,7 +68,7 @@ func NewUiNodeInputAttributesWithDefaults() *UiNodeInputAttributes { // GetAutocomplete returns the Autocomplete field value if set, zero value otherwise. func (o *UiNodeInputAttributes) GetAutocomplete() string { - if o == nil || o.Autocomplete == nil { + if o == nil || IsNil(o.Autocomplete) { var ret string return ret } @@ -71,7 +78,7 @@ func (o *UiNodeInputAttributes) GetAutocomplete() string { // GetAutocompleteOk returns a tuple with the Autocomplete field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiNodeInputAttributes) GetAutocompleteOk() (*string, bool) { - if o == nil || o.Autocomplete == nil { + if o == nil || IsNil(o.Autocomplete) { return nil, false } return o.Autocomplete, true @@ -79,7 +86,7 @@ func (o *UiNodeInputAttributes) GetAutocompleteOk() (*string, bool) { // HasAutocomplete returns a boolean if a field has been set. func (o *UiNodeInputAttributes) HasAutocomplete() bool { - if o != nil && o.Autocomplete != nil { + if o != nil && !IsNil(o.Autocomplete) { return true } @@ -117,7 +124,7 @@ func (o *UiNodeInputAttributes) SetDisabled(v bool) { // GetLabel returns the Label field value if set, zero value otherwise. func (o *UiNodeInputAttributes) GetLabel() UiText { - if o == nil || o.Label == nil { + if o == nil || IsNil(o.Label) { var ret UiText return ret } @@ -127,7 +134,7 @@ func (o *UiNodeInputAttributes) GetLabel() UiText { // GetLabelOk returns a tuple with the Label field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiNodeInputAttributes) GetLabelOk() (*UiText, bool) { - if o == nil || o.Label == nil { + if o == nil || IsNil(o.Label) { return nil, false } return o.Label, true @@ -135,7 +142,7 @@ func (o *UiNodeInputAttributes) GetLabelOk() (*UiText, bool) { // HasLabel returns a boolean if a field has been set. func (o *UiNodeInputAttributes) HasLabel() bool { - if o != nil && o.Label != nil { + if o != nil && !IsNil(o.Label) { return true } @@ -197,7 +204,7 @@ func (o *UiNodeInputAttributes) SetNodeType(v string) { // GetOnclick returns the Onclick field value if set, zero value otherwise. func (o *UiNodeInputAttributes) GetOnclick() string { - if o == nil || o.Onclick == nil { + if o == nil || IsNil(o.Onclick) { var ret string return ret } @@ -207,7 +214,7 @@ func (o *UiNodeInputAttributes) GetOnclick() string { // GetOnclickOk returns a tuple with the Onclick field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiNodeInputAttributes) GetOnclickOk() (*string, bool) { - if o == nil || o.Onclick == nil { + if o == nil || IsNil(o.Onclick) { return nil, false } return o.Onclick, true @@ -215,7 +222,7 @@ func (o *UiNodeInputAttributes) GetOnclickOk() (*string, bool) { // HasOnclick returns a boolean if a field has been set. func (o *UiNodeInputAttributes) HasOnclick() bool { - if o != nil && o.Onclick != nil { + if o != nil && !IsNil(o.Onclick) { return true } @@ -229,7 +236,7 @@ func (o *UiNodeInputAttributes) SetOnclick(v string) { // GetPattern returns the Pattern field value if set, zero value otherwise. func (o *UiNodeInputAttributes) GetPattern() string { - if o == nil || o.Pattern == nil { + if o == nil || IsNil(o.Pattern) { var ret string return ret } @@ -239,7 +246,7 @@ func (o *UiNodeInputAttributes) GetPattern() string { // GetPatternOk returns a tuple with the Pattern field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiNodeInputAttributes) GetPatternOk() (*string, bool) { - if o == nil || o.Pattern == nil { + if o == nil || IsNil(o.Pattern) { return nil, false } return o.Pattern, true @@ -247,7 +254,7 @@ func (o *UiNodeInputAttributes) GetPatternOk() (*string, bool) { // HasPattern returns a boolean if a field has been set. func (o *UiNodeInputAttributes) HasPattern() bool { - if o != nil && o.Pattern != nil { + if o != nil && !IsNil(o.Pattern) { return true } @@ -261,7 +268,7 @@ func (o *UiNodeInputAttributes) SetPattern(v string) { // GetRequired returns the Required field value if set, zero value otherwise. func (o *UiNodeInputAttributes) GetRequired() bool { - if o == nil || o.Required == nil { + if o == nil || IsNil(o.Required) { var ret bool return ret } @@ -271,7 +278,7 @@ func (o *UiNodeInputAttributes) GetRequired() bool { // GetRequiredOk returns a tuple with the Required field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiNodeInputAttributes) GetRequiredOk() (*bool, bool) { - if o == nil || o.Required == nil { + if o == nil || IsNil(o.Required) { return nil, false } return o.Required, true @@ -279,7 +286,7 @@ func (o *UiNodeInputAttributes) GetRequiredOk() (*bool, bool) { // HasRequired returns a boolean if a field has been set. func (o *UiNodeInputAttributes) HasRequired() bool { - if o != nil && o.Required != nil { + if o != nil && !IsNil(o.Required) { return true } @@ -328,7 +335,7 @@ func (o *UiNodeInputAttributes) GetValue() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *UiNodeInputAttributes) GetValueOk() (*interface{}, bool) { - if o == nil || o.Value == nil { + if o == nil || IsNil(o.Value) { return nil, false } return &o.Value, true @@ -336,7 +343,7 @@ func (o *UiNodeInputAttributes) GetValueOk() (*interface{}, bool) { // HasValue returns a boolean if a field has been set. func (o *UiNodeInputAttributes) HasValue() bool { - if o != nil && o.Value != nil { + if o != nil && IsNil(o.Value) { return true } @@ -349,38 +356,78 @@ func (o *UiNodeInputAttributes) SetValue(v interface{}) { } func (o UiNodeInputAttributes) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UiNodeInputAttributes) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Autocomplete != nil { + if !IsNil(o.Autocomplete) { toSerialize["autocomplete"] = o.Autocomplete } - if true { - toSerialize["disabled"] = o.Disabled - } - if o.Label != nil { + toSerialize["disabled"] = o.Disabled + if !IsNil(o.Label) { toSerialize["label"] = o.Label } - if true { - toSerialize["name"] = o.Name - } - if true { - toSerialize["node_type"] = o.NodeType - } - if o.Onclick != nil { + toSerialize["name"] = o.Name + toSerialize["node_type"] = o.NodeType + if !IsNil(o.Onclick) { toSerialize["onclick"] = o.Onclick } - if o.Pattern != nil { + if !IsNil(o.Pattern) { toSerialize["pattern"] = o.Pattern } - if o.Required != nil { + if !IsNil(o.Required) { toSerialize["required"] = o.Required } - if true { - toSerialize["type"] = o.Type - } + toSerialize["type"] = o.Type if o.Value != nil { toSerialize["value"] = o.Value } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UiNodeInputAttributes) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "disabled", + "name", + "node_type", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUiNodeInputAttributes := _UiNodeInputAttributes{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiNodeInputAttributes) + + if err != nil { + return err + } + + *o = UiNodeInputAttributes(varUiNodeInputAttributes) + + return err } type NullableUiNodeInputAttributes struct { diff --git a/internal/client-go/model_ui_node_meta.go b/internal/client-go/model_ui_node_meta.go index 88855b4d6c0c..c9ef8ebb1e3f 100644 --- a/internal/client-go/model_ui_node_meta.go +++ b/internal/client-go/model_ui_node_meta.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the UiNodeMeta type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNodeMeta{} + // UiNodeMeta This might include a label and other information that can optionally be used to render UIs. type UiNodeMeta struct { Label *UiText `json:"label,omitempty"` @@ -39,7 +42,7 @@ func NewUiNodeMetaWithDefaults() *UiNodeMeta { // GetLabel returns the Label field value if set, zero value otherwise. func (o *UiNodeMeta) GetLabel() UiText { - if o == nil || o.Label == nil { + if o == nil || IsNil(o.Label) { var ret UiText return ret } @@ -49,7 +52,7 @@ func (o *UiNodeMeta) GetLabel() UiText { // GetLabelOk returns a tuple with the Label field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiNodeMeta) GetLabelOk() (*UiText, bool) { - if o == nil || o.Label == nil { + if o == nil || IsNil(o.Label) { return nil, false } return o.Label, true @@ -57,7 +60,7 @@ func (o *UiNodeMeta) GetLabelOk() (*UiText, bool) { // HasLabel returns a boolean if a field has been set. func (o *UiNodeMeta) HasLabel() bool { - if o != nil && o.Label != nil { + if o != nil && !IsNil(o.Label) { return true } @@ -70,11 +73,19 @@ func (o *UiNodeMeta) SetLabel(v UiText) { } func (o UiNodeMeta) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UiNodeMeta) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Label != nil { + if !IsNil(o.Label) { toSerialize["label"] = o.Label } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableUiNodeMeta struct { diff --git a/internal/client-go/model_ui_node_script_attributes.go b/internal/client-go/model_ui_node_script_attributes.go index 21dca70cbe86..4e91e71dc30b 100644 --- a/internal/client-go/model_ui_node_script_attributes.go +++ b/internal/client-go/model_ui_node_script_attributes.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiNodeScriptAttributes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNodeScriptAttributes{} + // UiNodeScriptAttributes struct for UiNodeScriptAttributes type UiNodeScriptAttributes struct { // The script async type @@ -37,6 +42,8 @@ type UiNodeScriptAttributes struct { Type string `json:"type"` } +type _UiNodeScriptAttributes UiNodeScriptAttributes + // NewUiNodeScriptAttributes instantiates a new UiNodeScriptAttributes object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -280,35 +287,70 @@ func (o *UiNodeScriptAttributes) SetType(v string) { } func (o UiNodeScriptAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["async"] = o.Async - } - if true { - toSerialize["crossorigin"] = o.Crossorigin + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if true { - toSerialize["id"] = o.Id - } - if true { - toSerialize["integrity"] = o.Integrity - } - if true { - toSerialize["node_type"] = o.NodeType - } - if true { - toSerialize["nonce"] = o.Nonce + return json.Marshal(toSerialize) +} + +func (o UiNodeScriptAttributes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["async"] = o.Async + toSerialize["crossorigin"] = o.Crossorigin + toSerialize["id"] = o.Id + toSerialize["integrity"] = o.Integrity + toSerialize["node_type"] = o.NodeType + toSerialize["nonce"] = o.Nonce + toSerialize["referrerpolicy"] = o.Referrerpolicy + toSerialize["src"] = o.Src + toSerialize["type"] = o.Type + return toSerialize, nil +} + +func (o *UiNodeScriptAttributes) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "async", + "crossorigin", + "id", + "integrity", + "node_type", + "nonce", + "referrerpolicy", + "src", + "type", } - if true { - toSerialize["referrerpolicy"] = o.Referrerpolicy + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["src"] = o.Src + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["type"] = o.Type + + varUiNodeScriptAttributes := _UiNodeScriptAttributes{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiNodeScriptAttributes) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UiNodeScriptAttributes(varUiNodeScriptAttributes) + + return err } type NullableUiNodeScriptAttributes struct { diff --git a/internal/client-go/model_ui_node_text_attributes.go b/internal/client-go/model_ui_node_text_attributes.go index 6199187b5d75..b653ecf9762a 100644 --- a/internal/client-go/model_ui_node_text_attributes.go +++ b/internal/client-go/model_ui_node_text_attributes.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiNodeTextAttributes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNodeTextAttributes{} + // UiNodeTextAttributes struct for UiNodeTextAttributes type UiNodeTextAttributes struct { // A unique identifier @@ -24,6 +29,8 @@ type UiNodeTextAttributes struct { Text UiText `json:"text"` } +type _UiNodeTextAttributes UiNodeTextAttributes + // NewUiNodeTextAttributes instantiates a new UiNodeTextAttributes object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -117,17 +124,58 @@ func (o *UiNodeTextAttributes) SetText(v UiText) { } func (o UiNodeTextAttributes) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UiNodeTextAttributes) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["id"] = o.Id + toSerialize["id"] = o.Id + toSerialize["node_type"] = o.NodeType + toSerialize["text"] = o.Text + return toSerialize, nil +} + +func (o *UiNodeTextAttributes) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "node_type", + "text", } - if true { - toSerialize["node_type"] = o.NodeType + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["text"] = o.Text + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varUiNodeTextAttributes := _UiNodeTextAttributes{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiNodeTextAttributes) + + if err != nil { + return err + } + + *o = UiNodeTextAttributes(varUiNodeTextAttributes) + + return err } type NullableUiNodeTextAttributes struct { diff --git a/internal/client-go/model_ui_text.go b/internal/client-go/model_ui_text.go index 9189d34d39d1..c133009ea0ee 100644 --- a/internal/client-go/model_ui_text.go +++ b/internal/client-go/model_ui_text.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiText type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiText{} + // UiText struct for UiText type UiText struct { // The message's context. Useful when customizing messages. @@ -26,6 +31,8 @@ type UiText struct { Type string `json:"type"` } +type _UiText UiText + // NewUiText instantiates a new UiText object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -48,7 +55,7 @@ func NewUiTextWithDefaults() *UiText { // GetContext returns the Context field value if set, zero value otherwise. func (o *UiText) GetContext() map[string]interface{} { - if o == nil || o.Context == nil { + if o == nil || IsNil(o.Context) { var ret map[string]interface{} return ret } @@ -58,15 +65,15 @@ func (o *UiText) GetContext() map[string]interface{} { // GetContextOk returns a tuple with the Context field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiText) GetContextOk() (map[string]interface{}, bool) { - if o == nil || o.Context == nil { - return nil, false + if o == nil || IsNil(o.Context) { + return map[string]interface{}{}, false } return o.Context, true } // HasContext returns a boolean if a field has been set. func (o *UiText) HasContext() bool { - if o != nil && o.Context != nil { + if o != nil && !IsNil(o.Context) { return true } @@ -151,20 +158,61 @@ func (o *UiText) SetType(v string) { } func (o UiText) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UiText) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Context != nil { + if !IsNil(o.Context) { toSerialize["context"] = o.Context } - if true { - toSerialize["id"] = o.Id + toSerialize["id"] = o.Id + toSerialize["text"] = o.Text + toSerialize["type"] = o.Type + return toSerialize, nil +} + +func (o *UiText) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "text", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["text"] = o.Text + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["type"] = o.Type + + varUiText := _UiText{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiText) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UiText(varUiText) + + return err } type NullableUiText struct { diff --git a/internal/client-go/model_update_identity_body.go b/internal/client-go/model_update_identity_body.go index 9009e2a88b30..aad6654efb98 100644 --- a/internal/client-go/model_update_identity_body.go +++ b/internal/client-go/model_update_identity_body.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateIdentityBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateIdentityBody{} + // UpdateIdentityBody Update Identity Body type UpdateIdentityBody struct { Credentials *IdentityWithCredentials `json:"credentials,omitempty"` @@ -30,6 +35,8 @@ type UpdateIdentityBody struct { Traits map[string]interface{} `json:"traits"` } +type _UpdateIdentityBody UpdateIdentityBody + // NewUpdateIdentityBody instantiates a new UpdateIdentityBody object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -52,7 +59,7 @@ func NewUpdateIdentityBodyWithDefaults() *UpdateIdentityBody { // GetCredentials returns the Credentials field value if set, zero value otherwise. func (o *UpdateIdentityBody) GetCredentials() IdentityWithCredentials { - if o == nil || o.Credentials == nil { + if o == nil || IsNil(o.Credentials) { var ret IdentityWithCredentials return ret } @@ -62,7 +69,7 @@ func (o *UpdateIdentityBody) GetCredentials() IdentityWithCredentials { // GetCredentialsOk returns a tuple with the Credentials field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateIdentityBody) GetCredentialsOk() (*IdentityWithCredentials, bool) { - if o == nil || o.Credentials == nil { + if o == nil || IsNil(o.Credentials) { return nil, false } return o.Credentials, true @@ -70,7 +77,7 @@ func (o *UpdateIdentityBody) GetCredentialsOk() (*IdentityWithCredentials, bool) // HasCredentials returns a boolean if a field has been set. func (o *UpdateIdentityBody) HasCredentials() bool { - if o != nil && o.Credentials != nil { + if o != nil && !IsNil(o.Credentials) { return true } @@ -95,7 +102,7 @@ func (o *UpdateIdentityBody) GetMetadataAdmin() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *UpdateIdentityBody) GetMetadataAdminOk() (*interface{}, bool) { - if o == nil || o.MetadataAdmin == nil { + if o == nil || IsNil(o.MetadataAdmin) { return nil, false } return &o.MetadataAdmin, true @@ -103,7 +110,7 @@ func (o *UpdateIdentityBody) GetMetadataAdminOk() (*interface{}, bool) { // HasMetadataAdmin returns a boolean if a field has been set. func (o *UpdateIdentityBody) HasMetadataAdmin() bool { - if o != nil && o.MetadataAdmin != nil { + if o != nil && IsNil(o.MetadataAdmin) { return true } @@ -128,7 +135,7 @@ func (o *UpdateIdentityBody) GetMetadataPublic() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *UpdateIdentityBody) GetMetadataPublicOk() (*interface{}, bool) { - if o == nil || o.MetadataPublic == nil { + if o == nil || IsNil(o.MetadataPublic) { return nil, false } return &o.MetadataPublic, true @@ -136,7 +143,7 @@ func (o *UpdateIdentityBody) GetMetadataPublicOk() (*interface{}, bool) { // HasMetadataPublic returns a boolean if a field has been set. func (o *UpdateIdentityBody) HasMetadataPublic() bool { - if o != nil && o.MetadataPublic != nil { + if o != nil && IsNil(o.MetadataPublic) { return true } @@ -210,7 +217,7 @@ func (o *UpdateIdentityBody) GetTraits() map[string]interface{} { // and a boolean to check if the value has been set. func (o *UpdateIdentityBody) GetTraitsOk() (map[string]interface{}, bool) { if o == nil { - return nil, false + return map[string]interface{}{}, false } return o.Traits, true } @@ -221,8 +228,16 @@ func (o *UpdateIdentityBody) SetTraits(v map[string]interface{}) { } func (o UpdateIdentityBody) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateIdentityBody) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Credentials != nil { + if !IsNil(o.Credentials) { toSerialize["credentials"] = o.Credentials } if o.MetadataAdmin != nil { @@ -231,16 +246,49 @@ func (o UpdateIdentityBody) MarshalJSON() ([]byte, error) { if o.MetadataPublic != nil { toSerialize["metadata_public"] = o.MetadataPublic } - if true { - toSerialize["schema_id"] = o.SchemaId + toSerialize["schema_id"] = o.SchemaId + toSerialize["state"] = o.State + toSerialize["traits"] = o.Traits + return toSerialize, nil +} + +func (o *UpdateIdentityBody) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "schema_id", + "state", + "traits", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["state"] = o.State + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["traits"] = o.Traits + + varUpdateIdentityBody := _UpdateIdentityBody{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateIdentityBody) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UpdateIdentityBody(varUpdateIdentityBody) + + return err } type NullableUpdateIdentityBody struct { diff --git a/internal/client-go/model_update_login_flow_body.go b/internal/client-go/model_update_login_flow_body.go index 36033328e78d..0ba555f3aeb2 100644 --- a/internal/client-go/model_update_login_flow_body.go +++ b/internal/client-go/model_update_login_flow_body.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -159,11 +159,11 @@ func (dst *UpdateLoginFlowBody) UnmarshalJSON(data []byte) error { dst.UpdateLoginFlowWithTotpMethod = nil dst.UpdateLoginFlowWithWebAuthnMethod = nil - return fmt.Errorf("Data matches more than one schema in oneOf(UpdateLoginFlowBody)") + return fmt.Errorf("data matches more than one schema in oneOf(UpdateLoginFlowBody)") } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(UpdateLoginFlowBody)") + return fmt.Errorf("data failed to match schemas in oneOf(UpdateLoginFlowBody)") } } diff --git a/internal/client-go/model_update_login_flow_with_code_method.go b/internal/client-go/model_update_login_flow_with_code_method.go index bd97ab583ebc..a0341b379f10 100644 --- a/internal/client-go/model_update_login_flow_with_code_method.go +++ b/internal/client-go/model_update_login_flow_with_code_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateLoginFlowWithCodeMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLoginFlowWithCodeMethod{} + // UpdateLoginFlowWithCodeMethod Update Login flow using the code method type UpdateLoginFlowWithCodeMethod struct { // Code is the 6 digits code sent to the user @@ -29,6 +34,8 @@ type UpdateLoginFlowWithCodeMethod struct { Resend *string `json:"resend,omitempty"` } +type _UpdateLoginFlowWithCodeMethod UpdateLoginFlowWithCodeMethod + // NewUpdateLoginFlowWithCodeMethod instantiates a new UpdateLoginFlowWithCodeMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -50,7 +57,7 @@ func NewUpdateLoginFlowWithCodeMethodWithDefaults() *UpdateLoginFlowWithCodeMeth // GetCode returns the Code field value if set, zero value otherwise. func (o *UpdateLoginFlowWithCodeMethod) GetCode() string { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { var ret string return ret } @@ -60,7 +67,7 @@ func (o *UpdateLoginFlowWithCodeMethod) GetCode() string { // GetCodeOk returns a tuple with the Code field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithCodeMethod) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { return nil, false } return o.Code, true @@ -68,7 +75,7 @@ func (o *UpdateLoginFlowWithCodeMethod) GetCodeOk() (*string, bool) { // HasCode returns a boolean if a field has been set. func (o *UpdateLoginFlowWithCodeMethod) HasCode() bool { - if o != nil && o.Code != nil { + if o != nil && !IsNil(o.Code) { return true } @@ -106,7 +113,7 @@ func (o *UpdateLoginFlowWithCodeMethod) SetCsrfToken(v string) { // GetIdentifier returns the Identifier field value if set, zero value otherwise. func (o *UpdateLoginFlowWithCodeMethod) GetIdentifier() string { - if o == nil || o.Identifier == nil { + if o == nil || IsNil(o.Identifier) { var ret string return ret } @@ -116,7 +123,7 @@ func (o *UpdateLoginFlowWithCodeMethod) GetIdentifier() string { // GetIdentifierOk returns a tuple with the Identifier field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithCodeMethod) GetIdentifierOk() (*string, bool) { - if o == nil || o.Identifier == nil { + if o == nil || IsNil(o.Identifier) { return nil, false } return o.Identifier, true @@ -124,7 +131,7 @@ func (o *UpdateLoginFlowWithCodeMethod) GetIdentifierOk() (*string, bool) { // HasIdentifier returns a boolean if a field has been set. func (o *UpdateLoginFlowWithCodeMethod) HasIdentifier() bool { - if o != nil && o.Identifier != nil { + if o != nil && !IsNil(o.Identifier) { return true } @@ -162,7 +169,7 @@ func (o *UpdateLoginFlowWithCodeMethod) SetMethod(v string) { // GetResend returns the Resend field value if set, zero value otherwise. func (o *UpdateLoginFlowWithCodeMethod) GetResend() string { - if o == nil || o.Resend == nil { + if o == nil || IsNil(o.Resend) { var ret string return ret } @@ -172,7 +179,7 @@ func (o *UpdateLoginFlowWithCodeMethod) GetResend() string { // GetResendOk returns a tuple with the Resend field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithCodeMethod) GetResendOk() (*string, bool) { - if o == nil || o.Resend == nil { + if o == nil || IsNil(o.Resend) { return nil, false } return o.Resend, true @@ -180,7 +187,7 @@ func (o *UpdateLoginFlowWithCodeMethod) GetResendOk() (*string, bool) { // HasResend returns a boolean if a field has been set. func (o *UpdateLoginFlowWithCodeMethod) HasResend() bool { - if o != nil && o.Resend != nil { + if o != nil && !IsNil(o.Resend) { return true } @@ -193,23 +200,65 @@ func (o *UpdateLoginFlowWithCodeMethod) SetResend(v string) { } func (o UpdateLoginFlowWithCodeMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLoginFlowWithCodeMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Code != nil { + if !IsNil(o.Code) { toSerialize["code"] = o.Code } - if true { - toSerialize["csrf_token"] = o.CsrfToken - } - if o.Identifier != nil { + toSerialize["csrf_token"] = o.CsrfToken + if !IsNil(o.Identifier) { toSerialize["identifier"] = o.Identifier } - if true { - toSerialize["method"] = o.Method - } - if o.Resend != nil { + toSerialize["method"] = o.Method + if !IsNil(o.Resend) { toSerialize["resend"] = o.Resend } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateLoginFlowWithCodeMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "csrf_token", + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateLoginFlowWithCodeMethod := _UpdateLoginFlowWithCodeMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateLoginFlowWithCodeMethod) + + if err != nil { + return err + } + + *o = UpdateLoginFlowWithCodeMethod(varUpdateLoginFlowWithCodeMethod) + + return err } type NullableUpdateLoginFlowWithCodeMethod struct { diff --git a/internal/client-go/model_update_login_flow_with_lookup_secret_method.go b/internal/client-go/model_update_login_flow_with_lookup_secret_method.go index 3a0c81aa6b55..58c58eeb6adb 100644 --- a/internal/client-go/model_update_login_flow_with_lookup_secret_method.go +++ b/internal/client-go/model_update_login_flow_with_lookup_secret_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateLoginFlowWithLookupSecretMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLoginFlowWithLookupSecretMethod{} + // UpdateLoginFlowWithLookupSecretMethod Update Login Flow with Lookup Secret Method type UpdateLoginFlowWithLookupSecretMethod struct { // Sending the anti-csrf token is only required for browser login flows. @@ -25,6 +30,8 @@ type UpdateLoginFlowWithLookupSecretMethod struct { Method string `json:"method"` } +type _UpdateLoginFlowWithLookupSecretMethod UpdateLoginFlowWithLookupSecretMethod + // NewUpdateLoginFlowWithLookupSecretMethod instantiates a new UpdateLoginFlowWithLookupSecretMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -46,7 +53,7 @@ func NewUpdateLoginFlowWithLookupSecretMethodWithDefaults() *UpdateLoginFlowWith // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateLoginFlowWithLookupSecretMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -56,7 +63,7 @@ func (o *UpdateLoginFlowWithLookupSecretMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithLookupSecretMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -64,7 +71,7 @@ func (o *UpdateLoginFlowWithLookupSecretMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateLoginFlowWithLookupSecretMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -125,17 +132,59 @@ func (o *UpdateLoginFlowWithLookupSecretMethod) SetMethod(v string) { } func (o UpdateLoginFlowWithLookupSecretMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLoginFlowWithLookupSecretMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["lookup_secret"] = o.LookupSecret + toSerialize["lookup_secret"] = o.LookupSecret + toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateLoginFlowWithLookupSecretMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "lookup_secret", + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["method"] = o.Method + + varUpdateLoginFlowWithLookupSecretMethod := _UpdateLoginFlowWithLookupSecretMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateLoginFlowWithLookupSecretMethod) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UpdateLoginFlowWithLookupSecretMethod(varUpdateLoginFlowWithLookupSecretMethod) + + return err } type NullableUpdateLoginFlowWithLookupSecretMethod struct { diff --git a/internal/client-go/model_update_login_flow_with_oidc_method.go b/internal/client-go/model_update_login_flow_with_oidc_method.go index c196eb2121da..5462d3a9a665 100644 --- a/internal/client-go/model_update_login_flow_with_oidc_method.go +++ b/internal/client-go/model_update_login_flow_with_oidc_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateLoginFlowWithOidcMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLoginFlowWithOidcMethod{} + // UpdateLoginFlowWithOidcMethod Update Login Flow with OpenID Connect Method type UpdateLoginFlowWithOidcMethod struct { // The CSRF Token @@ -33,6 +38,8 @@ type UpdateLoginFlowWithOidcMethod struct { UpstreamParameters map[string]interface{} `json:"upstream_parameters,omitempty"` } +type _UpdateLoginFlowWithOidcMethod UpdateLoginFlowWithOidcMethod + // NewUpdateLoginFlowWithOidcMethod instantiates a new UpdateLoginFlowWithOidcMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -54,7 +61,7 @@ func NewUpdateLoginFlowWithOidcMethodWithDefaults() *UpdateLoginFlowWithOidcMeth // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateLoginFlowWithOidcMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -64,7 +71,7 @@ func (o *UpdateLoginFlowWithOidcMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithOidcMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -72,7 +79,7 @@ func (o *UpdateLoginFlowWithOidcMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateLoginFlowWithOidcMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -86,7 +93,7 @@ func (o *UpdateLoginFlowWithOidcMethod) SetCsrfToken(v string) { // GetIdToken returns the IdToken field value if set, zero value otherwise. func (o *UpdateLoginFlowWithOidcMethod) GetIdToken() string { - if o == nil || o.IdToken == nil { + if o == nil || IsNil(o.IdToken) { var ret string return ret } @@ -96,7 +103,7 @@ func (o *UpdateLoginFlowWithOidcMethod) GetIdToken() string { // GetIdTokenOk returns a tuple with the IdToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithOidcMethod) GetIdTokenOk() (*string, bool) { - if o == nil || o.IdToken == nil { + if o == nil || IsNil(o.IdToken) { return nil, false } return o.IdToken, true @@ -104,7 +111,7 @@ func (o *UpdateLoginFlowWithOidcMethod) GetIdTokenOk() (*string, bool) { // HasIdToken returns a boolean if a field has been set. func (o *UpdateLoginFlowWithOidcMethod) HasIdToken() bool { - if o != nil && o.IdToken != nil { + if o != nil && !IsNil(o.IdToken) { return true } @@ -118,7 +125,7 @@ func (o *UpdateLoginFlowWithOidcMethod) SetIdToken(v string) { // GetIdTokenNonce returns the IdTokenNonce field value if set, zero value otherwise. func (o *UpdateLoginFlowWithOidcMethod) GetIdTokenNonce() string { - if o == nil || o.IdTokenNonce == nil { + if o == nil || IsNil(o.IdTokenNonce) { var ret string return ret } @@ -128,7 +135,7 @@ func (o *UpdateLoginFlowWithOidcMethod) GetIdTokenNonce() string { // GetIdTokenNonceOk returns a tuple with the IdTokenNonce field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithOidcMethod) GetIdTokenNonceOk() (*string, bool) { - if o == nil || o.IdTokenNonce == nil { + if o == nil || IsNil(o.IdTokenNonce) { return nil, false } return o.IdTokenNonce, true @@ -136,7 +143,7 @@ func (o *UpdateLoginFlowWithOidcMethod) GetIdTokenNonceOk() (*string, bool) { // HasIdTokenNonce returns a boolean if a field has been set. func (o *UpdateLoginFlowWithOidcMethod) HasIdTokenNonce() bool { - if o != nil && o.IdTokenNonce != nil { + if o != nil && !IsNil(o.IdTokenNonce) { return true } @@ -198,7 +205,7 @@ func (o *UpdateLoginFlowWithOidcMethod) SetProvider(v string) { // GetTraits returns the Traits field value if set, zero value otherwise. func (o *UpdateLoginFlowWithOidcMethod) GetTraits() map[string]interface{} { - if o == nil || o.Traits == nil { + if o == nil || IsNil(o.Traits) { var ret map[string]interface{} return ret } @@ -208,15 +215,15 @@ func (o *UpdateLoginFlowWithOidcMethod) GetTraits() map[string]interface{} { // GetTraitsOk returns a tuple with the Traits field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithOidcMethod) GetTraitsOk() (map[string]interface{}, bool) { - if o == nil || o.Traits == nil { - return nil, false + if o == nil || IsNil(o.Traits) { + return map[string]interface{}{}, false } return o.Traits, true } // HasTraits returns a boolean if a field has been set. func (o *UpdateLoginFlowWithOidcMethod) HasTraits() bool { - if o != nil && o.Traits != nil { + if o != nil && !IsNil(o.Traits) { return true } @@ -230,7 +237,7 @@ func (o *UpdateLoginFlowWithOidcMethod) SetTraits(v map[string]interface{}) { // GetUpstreamParameters returns the UpstreamParameters field value if set, zero value otherwise. func (o *UpdateLoginFlowWithOidcMethod) GetUpstreamParameters() map[string]interface{} { - if o == nil || o.UpstreamParameters == nil { + if o == nil || IsNil(o.UpstreamParameters) { var ret map[string]interface{} return ret } @@ -240,15 +247,15 @@ func (o *UpdateLoginFlowWithOidcMethod) GetUpstreamParameters() map[string]inter // GetUpstreamParametersOk returns a tuple with the UpstreamParameters field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithOidcMethod) GetUpstreamParametersOk() (map[string]interface{}, bool) { - if o == nil || o.UpstreamParameters == nil { - return nil, false + if o == nil || IsNil(o.UpstreamParameters) { + return map[string]interface{}{}, false } return o.UpstreamParameters, true } // HasUpstreamParameters returns a boolean if a field has been set. func (o *UpdateLoginFlowWithOidcMethod) HasUpstreamParameters() bool { - if o != nil && o.UpstreamParameters != nil { + if o != nil && !IsNil(o.UpstreamParameters) { return true } @@ -261,29 +268,71 @@ func (o *UpdateLoginFlowWithOidcMethod) SetUpstreamParameters(v map[string]inter } func (o UpdateLoginFlowWithOidcMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLoginFlowWithOidcMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if o.IdToken != nil { + if !IsNil(o.IdToken) { toSerialize["id_token"] = o.IdToken } - if o.IdTokenNonce != nil { + if !IsNil(o.IdTokenNonce) { toSerialize["id_token_nonce"] = o.IdTokenNonce } - if true { - toSerialize["method"] = o.Method - } - if true { - toSerialize["provider"] = o.Provider - } - if o.Traits != nil { + toSerialize["method"] = o.Method + toSerialize["provider"] = o.Provider + if !IsNil(o.Traits) { toSerialize["traits"] = o.Traits } - if o.UpstreamParameters != nil { + if !IsNil(o.UpstreamParameters) { toSerialize["upstream_parameters"] = o.UpstreamParameters } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateLoginFlowWithOidcMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "provider", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateLoginFlowWithOidcMethod := _UpdateLoginFlowWithOidcMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateLoginFlowWithOidcMethod) + + if err != nil { + return err + } + + *o = UpdateLoginFlowWithOidcMethod(varUpdateLoginFlowWithOidcMethod) + + return err } type NullableUpdateLoginFlowWithOidcMethod struct { diff --git a/internal/client-go/model_update_login_flow_with_password_method.go b/internal/client-go/model_update_login_flow_with_password_method.go index 35a9b590bd04..bbacb98dd4c9 100644 --- a/internal/client-go/model_update_login_flow_with_password_method.go +++ b/internal/client-go/model_update_login_flow_with_password_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateLoginFlowWithPasswordMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLoginFlowWithPasswordMethod{} + // UpdateLoginFlowWithPasswordMethod Update Login Flow with Password Method type UpdateLoginFlowWithPasswordMethod struct { // Sending the anti-csrf token is only required for browser login flows. @@ -29,6 +34,8 @@ type UpdateLoginFlowWithPasswordMethod struct { PasswordIdentifier *string `json:"password_identifier,omitempty"` } +type _UpdateLoginFlowWithPasswordMethod UpdateLoginFlowWithPasswordMethod + // NewUpdateLoginFlowWithPasswordMethod instantiates a new UpdateLoginFlowWithPasswordMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -51,7 +58,7 @@ func NewUpdateLoginFlowWithPasswordMethodWithDefaults() *UpdateLoginFlowWithPass // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateLoginFlowWithPasswordMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -61,7 +68,7 @@ func (o *UpdateLoginFlowWithPasswordMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithPasswordMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -69,7 +76,7 @@ func (o *UpdateLoginFlowWithPasswordMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateLoginFlowWithPasswordMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -155,7 +162,7 @@ func (o *UpdateLoginFlowWithPasswordMethod) SetPassword(v string) { // GetPasswordIdentifier returns the PasswordIdentifier field value if set, zero value otherwise. func (o *UpdateLoginFlowWithPasswordMethod) GetPasswordIdentifier() string { - if o == nil || o.PasswordIdentifier == nil { + if o == nil || IsNil(o.PasswordIdentifier) { var ret string return ret } @@ -165,7 +172,7 @@ func (o *UpdateLoginFlowWithPasswordMethod) GetPasswordIdentifier() string { // GetPasswordIdentifierOk returns a tuple with the PasswordIdentifier field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithPasswordMethod) GetPasswordIdentifierOk() (*string, bool) { - if o == nil || o.PasswordIdentifier == nil { + if o == nil || IsNil(o.PasswordIdentifier) { return nil, false } return o.PasswordIdentifier, true @@ -173,7 +180,7 @@ func (o *UpdateLoginFlowWithPasswordMethod) GetPasswordIdentifierOk() (*string, // HasPasswordIdentifier returns a boolean if a field has been set. func (o *UpdateLoginFlowWithPasswordMethod) HasPasswordIdentifier() bool { - if o != nil && o.PasswordIdentifier != nil { + if o != nil && !IsNil(o.PasswordIdentifier) { return true } @@ -186,23 +193,64 @@ func (o *UpdateLoginFlowWithPasswordMethod) SetPasswordIdentifier(v string) { } func (o UpdateLoginFlowWithPasswordMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLoginFlowWithPasswordMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["identifier"] = o.Identifier + toSerialize["identifier"] = o.Identifier + toSerialize["method"] = o.Method + toSerialize["password"] = o.Password + if !IsNil(o.PasswordIdentifier) { + toSerialize["password_identifier"] = o.PasswordIdentifier } - if true { - toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateLoginFlowWithPasswordMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "identifier", + "method", + "password", } - if true { - toSerialize["password"] = o.Password + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if o.PasswordIdentifier != nil { - toSerialize["password_identifier"] = o.PasswordIdentifier + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varUpdateLoginFlowWithPasswordMethod := _UpdateLoginFlowWithPasswordMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateLoginFlowWithPasswordMethod) + + if err != nil { + return err + } + + *o = UpdateLoginFlowWithPasswordMethod(varUpdateLoginFlowWithPasswordMethod) + + return err } type NullableUpdateLoginFlowWithPasswordMethod struct { diff --git a/internal/client-go/model_update_login_flow_with_totp_method.go b/internal/client-go/model_update_login_flow_with_totp_method.go index 34d3b316dd01..9a1bcaabe0ff 100644 --- a/internal/client-go/model_update_login_flow_with_totp_method.go +++ b/internal/client-go/model_update_login_flow_with_totp_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateLoginFlowWithTotpMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLoginFlowWithTotpMethod{} + // UpdateLoginFlowWithTotpMethod Update Login Flow with TOTP Method type UpdateLoginFlowWithTotpMethod struct { // Sending the anti-csrf token is only required for browser login flows. @@ -25,6 +30,8 @@ type UpdateLoginFlowWithTotpMethod struct { TotpCode string `json:"totp_code"` } +type _UpdateLoginFlowWithTotpMethod UpdateLoginFlowWithTotpMethod + // NewUpdateLoginFlowWithTotpMethod instantiates a new UpdateLoginFlowWithTotpMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -46,7 +53,7 @@ func NewUpdateLoginFlowWithTotpMethodWithDefaults() *UpdateLoginFlowWithTotpMeth // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateLoginFlowWithTotpMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -56,7 +63,7 @@ func (o *UpdateLoginFlowWithTotpMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithTotpMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -64,7 +71,7 @@ func (o *UpdateLoginFlowWithTotpMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateLoginFlowWithTotpMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -125,17 +132,59 @@ func (o *UpdateLoginFlowWithTotpMethod) SetTotpCode(v string) { } func (o UpdateLoginFlowWithTotpMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLoginFlowWithTotpMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + toSerialize["totp_code"] = o.TotpCode + return toSerialize, nil +} + +func (o *UpdateLoginFlowWithTotpMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "totp_code", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["totp_code"] = o.TotpCode + + varUpdateLoginFlowWithTotpMethod := _UpdateLoginFlowWithTotpMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateLoginFlowWithTotpMethod) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UpdateLoginFlowWithTotpMethod(varUpdateLoginFlowWithTotpMethod) + + return err } type NullableUpdateLoginFlowWithTotpMethod struct { diff --git a/internal/client-go/model_update_login_flow_with_web_authn_method.go b/internal/client-go/model_update_login_flow_with_web_authn_method.go index d5d8554febb4..6ba1ddfe0d71 100644 --- a/internal/client-go/model_update_login_flow_with_web_authn_method.go +++ b/internal/client-go/model_update_login_flow_with_web_authn_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateLoginFlowWithWebAuthnMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLoginFlowWithWebAuthnMethod{} + // UpdateLoginFlowWithWebAuthnMethod Update Login Flow with WebAuthn Method type UpdateLoginFlowWithWebAuthnMethod struct { // Sending the anti-csrf token is only required for browser login flows. @@ -27,6 +32,8 @@ type UpdateLoginFlowWithWebAuthnMethod struct { WebauthnLogin *string `json:"webauthn_login,omitempty"` } +type _UpdateLoginFlowWithWebAuthnMethod UpdateLoginFlowWithWebAuthnMethod + // NewUpdateLoginFlowWithWebAuthnMethod instantiates a new UpdateLoginFlowWithWebAuthnMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -48,7 +55,7 @@ func NewUpdateLoginFlowWithWebAuthnMethodWithDefaults() *UpdateLoginFlowWithWebA // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateLoginFlowWithWebAuthnMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -58,7 +65,7 @@ func (o *UpdateLoginFlowWithWebAuthnMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithWebAuthnMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -66,7 +73,7 @@ func (o *UpdateLoginFlowWithWebAuthnMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateLoginFlowWithWebAuthnMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -128,7 +135,7 @@ func (o *UpdateLoginFlowWithWebAuthnMethod) SetMethod(v string) { // GetWebauthnLogin returns the WebauthnLogin field value if set, zero value otherwise. func (o *UpdateLoginFlowWithWebAuthnMethod) GetWebauthnLogin() string { - if o == nil || o.WebauthnLogin == nil { + if o == nil || IsNil(o.WebauthnLogin) { var ret string return ret } @@ -138,7 +145,7 @@ func (o *UpdateLoginFlowWithWebAuthnMethod) GetWebauthnLogin() string { // GetWebauthnLoginOk returns a tuple with the WebauthnLogin field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithWebAuthnMethod) GetWebauthnLoginOk() (*string, bool) { - if o == nil || o.WebauthnLogin == nil { + if o == nil || IsNil(o.WebauthnLogin) { return nil, false } return o.WebauthnLogin, true @@ -146,7 +153,7 @@ func (o *UpdateLoginFlowWithWebAuthnMethod) GetWebauthnLoginOk() (*string, bool) // HasWebauthnLogin returns a boolean if a field has been set. func (o *UpdateLoginFlowWithWebAuthnMethod) HasWebauthnLogin() bool { - if o != nil && o.WebauthnLogin != nil { + if o != nil && !IsNil(o.WebauthnLogin) { return true } @@ -159,20 +166,62 @@ func (o *UpdateLoginFlowWithWebAuthnMethod) SetWebauthnLogin(v string) { } func (o UpdateLoginFlowWithWebAuthnMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLoginFlowWithWebAuthnMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["identifier"] = o.Identifier + toSerialize["identifier"] = o.Identifier + toSerialize["method"] = o.Method + if !IsNil(o.WebauthnLogin) { + toSerialize["webauthn_login"] = o.WebauthnLogin } - if true { - toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateLoginFlowWithWebAuthnMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "identifier", + "method", } - if o.WebauthnLogin != nil { - toSerialize["webauthn_login"] = o.WebauthnLogin + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateLoginFlowWithWebAuthnMethod := _UpdateLoginFlowWithWebAuthnMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateLoginFlowWithWebAuthnMethod) + + if err != nil { + return err + } + + *o = UpdateLoginFlowWithWebAuthnMethod(varUpdateLoginFlowWithWebAuthnMethod) + + return err } type NullableUpdateLoginFlowWithWebAuthnMethod struct { diff --git a/internal/client-go/model_update_recovery_flow_body.go b/internal/client-go/model_update_recovery_flow_body.go index 6eea1d5d6b6a..3ea993b6cf9d 100644 --- a/internal/client-go/model_update_recovery_flow_body.go +++ b/internal/client-go/model_update_recovery_flow_body.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -71,11 +71,11 @@ func (dst *UpdateRecoveryFlowBody) UnmarshalJSON(data []byte) error { dst.UpdateRecoveryFlowWithCodeMethod = nil dst.UpdateRecoveryFlowWithLinkMethod = nil - return fmt.Errorf("Data matches more than one schema in oneOf(UpdateRecoveryFlowBody)") + return fmt.Errorf("data matches more than one schema in oneOf(UpdateRecoveryFlowBody)") } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(UpdateRecoveryFlowBody)") + return fmt.Errorf("data failed to match schemas in oneOf(UpdateRecoveryFlowBody)") } } diff --git a/internal/client-go/model_update_recovery_flow_with_code_method.go b/internal/client-go/model_update_recovery_flow_with_code_method.go index 8d440330c7b8..36e7ba8c6d46 100644 --- a/internal/client-go/model_update_recovery_flow_with_code_method.go +++ b/internal/client-go/model_update_recovery_flow_with_code_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateRecoveryFlowWithCodeMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRecoveryFlowWithCodeMethod{} + // UpdateRecoveryFlowWithCodeMethod Update Recovery Flow with Code Method type UpdateRecoveryFlowWithCodeMethod struct { // Code from the recovery email If you want to submit a code, use this field, but make sure to _not_ include the email field, as well. @@ -27,6 +32,8 @@ type UpdateRecoveryFlowWithCodeMethod struct { Method string `json:"method"` } +type _UpdateRecoveryFlowWithCodeMethod UpdateRecoveryFlowWithCodeMethod + // NewUpdateRecoveryFlowWithCodeMethod instantiates a new UpdateRecoveryFlowWithCodeMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -47,7 +54,7 @@ func NewUpdateRecoveryFlowWithCodeMethodWithDefaults() *UpdateRecoveryFlowWithCo // GetCode returns the Code field value if set, zero value otherwise. func (o *UpdateRecoveryFlowWithCodeMethod) GetCode() string { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { var ret string return ret } @@ -57,7 +64,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) GetCode() string { // GetCodeOk returns a tuple with the Code field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRecoveryFlowWithCodeMethod) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { return nil, false } return o.Code, true @@ -65,7 +72,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) GetCodeOk() (*string, bool) { // HasCode returns a boolean if a field has been set. func (o *UpdateRecoveryFlowWithCodeMethod) HasCode() bool { - if o != nil && o.Code != nil { + if o != nil && !IsNil(o.Code) { return true } @@ -79,7 +86,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) SetCode(v string) { // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRecoveryFlowWithCodeMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -89,7 +96,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRecoveryFlowWithCodeMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -97,7 +104,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateRecoveryFlowWithCodeMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -111,7 +118,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) SetCsrfToken(v string) { // GetEmail returns the Email field value if set, zero value otherwise. func (o *UpdateRecoveryFlowWithCodeMethod) GetEmail() string { - if o == nil || o.Email == nil { + if o == nil || IsNil(o.Email) { var ret string return ret } @@ -121,7 +128,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) GetEmail() string { // GetEmailOk returns a tuple with the Email field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRecoveryFlowWithCodeMethod) GetEmailOk() (*string, bool) { - if o == nil || o.Email == nil { + if o == nil || IsNil(o.Email) { return nil, false } return o.Email, true @@ -129,7 +136,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) GetEmailOk() (*string, bool) { // HasEmail returns a boolean if a field has been set. func (o *UpdateRecoveryFlowWithCodeMethod) HasEmail() bool { - if o != nil && o.Email != nil { + if o != nil && !IsNil(o.Email) { return true } @@ -166,20 +173,63 @@ func (o *UpdateRecoveryFlowWithCodeMethod) SetMethod(v string) { } func (o UpdateRecoveryFlowWithCodeMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRecoveryFlowWithCodeMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Code != nil { + if !IsNil(o.Code) { toSerialize["code"] = o.Code } - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if o.Email != nil { + if !IsNil(o.Email) { toSerialize["email"] = o.Email } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateRecoveryFlowWithCodeMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateRecoveryFlowWithCodeMethod := _UpdateRecoveryFlowWithCodeMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateRecoveryFlowWithCodeMethod) + + if err != nil { + return err + } + + *o = UpdateRecoveryFlowWithCodeMethod(varUpdateRecoveryFlowWithCodeMethod) + + return err } type NullableUpdateRecoveryFlowWithCodeMethod struct { diff --git a/internal/client-go/model_update_recovery_flow_with_link_method.go b/internal/client-go/model_update_recovery_flow_with_link_method.go index 8a8861d86f07..35bee4c8952c 100644 --- a/internal/client-go/model_update_recovery_flow_with_link_method.go +++ b/internal/client-go/model_update_recovery_flow_with_link_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateRecoveryFlowWithLinkMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRecoveryFlowWithLinkMethod{} + // UpdateRecoveryFlowWithLinkMethod Update Recovery Flow with Link Method type UpdateRecoveryFlowWithLinkMethod struct { // Sending the anti-csrf token is only required for browser login flows. @@ -25,6 +30,8 @@ type UpdateRecoveryFlowWithLinkMethod struct { Method string `json:"method"` } +type _UpdateRecoveryFlowWithLinkMethod UpdateRecoveryFlowWithLinkMethod + // NewUpdateRecoveryFlowWithLinkMethod instantiates a new UpdateRecoveryFlowWithLinkMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -46,7 +53,7 @@ func NewUpdateRecoveryFlowWithLinkMethodWithDefaults() *UpdateRecoveryFlowWithLi // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRecoveryFlowWithLinkMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -56,7 +63,7 @@ func (o *UpdateRecoveryFlowWithLinkMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRecoveryFlowWithLinkMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -64,7 +71,7 @@ func (o *UpdateRecoveryFlowWithLinkMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateRecoveryFlowWithLinkMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -125,17 +132,59 @@ func (o *UpdateRecoveryFlowWithLinkMethod) SetMethod(v string) { } func (o UpdateRecoveryFlowWithLinkMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRecoveryFlowWithLinkMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["email"] = o.Email + toSerialize["email"] = o.Email + toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateRecoveryFlowWithLinkMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "email", + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["method"] = o.Method + + varUpdateRecoveryFlowWithLinkMethod := _UpdateRecoveryFlowWithLinkMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateRecoveryFlowWithLinkMethod) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UpdateRecoveryFlowWithLinkMethod(varUpdateRecoveryFlowWithLinkMethod) + + return err } type NullableUpdateRecoveryFlowWithLinkMethod struct { diff --git a/internal/client-go/model_update_registration_flow_body.go b/internal/client-go/model_update_registration_flow_body.go index 0e36a95f635f..ff88ef9d4b31 100644 --- a/internal/client-go/model_update_registration_flow_body.go +++ b/internal/client-go/model_update_registration_flow_body.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -115,11 +115,11 @@ func (dst *UpdateRegistrationFlowBody) UnmarshalJSON(data []byte) error { dst.UpdateRegistrationFlowWithPasswordMethod = nil dst.UpdateRegistrationFlowWithWebAuthnMethod = nil - return fmt.Errorf("Data matches more than one schema in oneOf(UpdateRegistrationFlowBody)") + return fmt.Errorf("data matches more than one schema in oneOf(UpdateRegistrationFlowBody)") } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(UpdateRegistrationFlowBody)") + return fmt.Errorf("data failed to match schemas in oneOf(UpdateRegistrationFlowBody)") } } diff --git a/internal/client-go/model_update_registration_flow_with_code_method.go b/internal/client-go/model_update_registration_flow_with_code_method.go index 46b9126d666f..b33763bee073 100644 --- a/internal/client-go/model_update_registration_flow_with_code_method.go +++ b/internal/client-go/model_update_registration_flow_with_code_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateRegistrationFlowWithCodeMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRegistrationFlowWithCodeMethod{} + // UpdateRegistrationFlowWithCodeMethod Update Registration Flow with Code Method type UpdateRegistrationFlowWithCodeMethod struct { // The OTP Code sent to the user @@ -31,6 +36,8 @@ type UpdateRegistrationFlowWithCodeMethod struct { TransientPayload map[string]interface{} `json:"transient_payload,omitempty"` } +type _UpdateRegistrationFlowWithCodeMethod UpdateRegistrationFlowWithCodeMethod + // NewUpdateRegistrationFlowWithCodeMethod instantiates a new UpdateRegistrationFlowWithCodeMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -52,7 +59,7 @@ func NewUpdateRegistrationFlowWithCodeMethodWithDefaults() *UpdateRegistrationFl // GetCode returns the Code field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithCodeMethod) GetCode() string { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { var ret string return ret } @@ -62,7 +69,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetCode() string { // GetCodeOk returns a tuple with the Code field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithCodeMethod) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { return nil, false } return o.Code, true @@ -70,7 +77,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetCodeOk() (*string, bool) { // HasCode returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithCodeMethod) HasCode() bool { - if o != nil && o.Code != nil { + if o != nil && !IsNil(o.Code) { return true } @@ -84,7 +91,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) SetCode(v string) { // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithCodeMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -94,7 +101,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithCodeMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -102,7 +109,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithCodeMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -140,7 +147,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) SetMethod(v string) { // GetResend returns the Resend field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithCodeMethod) GetResend() string { - if o == nil || o.Resend == nil { + if o == nil || IsNil(o.Resend) { var ret string return ret } @@ -150,7 +157,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetResend() string { // GetResendOk returns a tuple with the Resend field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithCodeMethod) GetResendOk() (*string, bool) { - if o == nil || o.Resend == nil { + if o == nil || IsNil(o.Resend) { return nil, false } return o.Resend, true @@ -158,7 +165,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetResendOk() (*string, bool) { // HasResend returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithCodeMethod) HasResend() bool { - if o != nil && o.Resend != nil { + if o != nil && !IsNil(o.Resend) { return true } @@ -184,7 +191,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetTraits() map[string]interface{ // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithCodeMethod) GetTraitsOk() (map[string]interface{}, bool) { if o == nil { - return nil, false + return map[string]interface{}{}, false } return o.Traits, true } @@ -196,7 +203,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) SetTraits(v map[string]interface{ // GetTransientPayload returns the TransientPayload field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithCodeMethod) GetTransientPayload() map[string]interface{} { - if o == nil || o.TransientPayload == nil { + if o == nil || IsNil(o.TransientPayload) { var ret map[string]interface{} return ret } @@ -206,15 +213,15 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetTransientPayload() map[string] // GetTransientPayloadOk returns a tuple with the TransientPayload field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithCodeMethod) GetTransientPayloadOk() (map[string]interface{}, bool) { - if o == nil || o.TransientPayload == nil { - return nil, false + if o == nil || IsNil(o.TransientPayload) { + return map[string]interface{}{}, false } return o.TransientPayload, true } // HasTransientPayload returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithCodeMethod) HasTransientPayload() bool { - if o != nil && o.TransientPayload != nil { + if o != nil && !IsNil(o.TransientPayload) { return true } @@ -227,26 +234,68 @@ func (o *UpdateRegistrationFlowWithCodeMethod) SetTransientPayload(v map[string] } func (o UpdateRegistrationFlowWithCodeMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRegistrationFlowWithCodeMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Code != nil { + if !IsNil(o.Code) { toSerialize["code"] = o.Code } - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method - } - if o.Resend != nil { + toSerialize["method"] = o.Method + if !IsNil(o.Resend) { toSerialize["resend"] = o.Resend } - if true { - toSerialize["traits"] = o.Traits - } - if o.TransientPayload != nil { + toSerialize["traits"] = o.Traits + if !IsNil(o.TransientPayload) { toSerialize["transient_payload"] = o.TransientPayload } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateRegistrationFlowWithCodeMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "traits", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateRegistrationFlowWithCodeMethod := _UpdateRegistrationFlowWithCodeMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateRegistrationFlowWithCodeMethod) + + if err != nil { + return err + } + + *o = UpdateRegistrationFlowWithCodeMethod(varUpdateRegistrationFlowWithCodeMethod) + + return err } type NullableUpdateRegistrationFlowWithCodeMethod struct { diff --git a/internal/client-go/model_update_registration_flow_with_oidc_method.go b/internal/client-go/model_update_registration_flow_with_oidc_method.go index 509e978a0627..058422b9bfcf 100644 --- a/internal/client-go/model_update_registration_flow_with_oidc_method.go +++ b/internal/client-go/model_update_registration_flow_with_oidc_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateRegistrationFlowWithOidcMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRegistrationFlowWithOidcMethod{} + // UpdateRegistrationFlowWithOidcMethod Update Registration Flow with OpenID Connect Method type UpdateRegistrationFlowWithOidcMethod struct { // The CSRF Token @@ -35,6 +40,8 @@ type UpdateRegistrationFlowWithOidcMethod struct { UpstreamParameters map[string]interface{} `json:"upstream_parameters,omitempty"` } +type _UpdateRegistrationFlowWithOidcMethod UpdateRegistrationFlowWithOidcMethod + // NewUpdateRegistrationFlowWithOidcMethod instantiates a new UpdateRegistrationFlowWithOidcMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -56,7 +63,7 @@ func NewUpdateRegistrationFlowWithOidcMethodWithDefaults() *UpdateRegistrationFl // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithOidcMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -66,7 +73,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithOidcMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -74,7 +81,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithOidcMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -88,7 +95,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) SetCsrfToken(v string) { // GetIdToken returns the IdToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithOidcMethod) GetIdToken() string { - if o == nil || o.IdToken == nil { + if o == nil || IsNil(o.IdToken) { var ret string return ret } @@ -98,7 +105,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetIdToken() string { // GetIdTokenOk returns a tuple with the IdToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithOidcMethod) GetIdTokenOk() (*string, bool) { - if o == nil || o.IdToken == nil { + if o == nil || IsNil(o.IdToken) { return nil, false } return o.IdToken, true @@ -106,7 +113,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetIdTokenOk() (*string, bool) { // HasIdToken returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithOidcMethod) HasIdToken() bool { - if o != nil && o.IdToken != nil { + if o != nil && !IsNil(o.IdToken) { return true } @@ -120,7 +127,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) SetIdToken(v string) { // GetIdTokenNonce returns the IdTokenNonce field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithOidcMethod) GetIdTokenNonce() string { - if o == nil || o.IdTokenNonce == nil { + if o == nil || IsNil(o.IdTokenNonce) { var ret string return ret } @@ -130,7 +137,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetIdTokenNonce() string { // GetIdTokenNonceOk returns a tuple with the IdTokenNonce field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithOidcMethod) GetIdTokenNonceOk() (*string, bool) { - if o == nil || o.IdTokenNonce == nil { + if o == nil || IsNil(o.IdTokenNonce) { return nil, false } return o.IdTokenNonce, true @@ -138,7 +145,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetIdTokenNonceOk() (*string, boo // HasIdTokenNonce returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithOidcMethod) HasIdTokenNonce() bool { - if o != nil && o.IdTokenNonce != nil { + if o != nil && !IsNil(o.IdTokenNonce) { return true } @@ -200,7 +207,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) SetProvider(v string) { // GetTraits returns the Traits field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithOidcMethod) GetTraits() map[string]interface{} { - if o == nil || o.Traits == nil { + if o == nil || IsNil(o.Traits) { var ret map[string]interface{} return ret } @@ -210,15 +217,15 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetTraits() map[string]interface{ // GetTraitsOk returns a tuple with the Traits field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithOidcMethod) GetTraitsOk() (map[string]interface{}, bool) { - if o == nil || o.Traits == nil { - return nil, false + if o == nil || IsNil(o.Traits) { + return map[string]interface{}{}, false } return o.Traits, true } // HasTraits returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithOidcMethod) HasTraits() bool { - if o != nil && o.Traits != nil { + if o != nil && !IsNil(o.Traits) { return true } @@ -232,7 +239,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) SetTraits(v map[string]interface{ // GetTransientPayload returns the TransientPayload field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithOidcMethod) GetTransientPayload() map[string]interface{} { - if o == nil || o.TransientPayload == nil { + if o == nil || IsNil(o.TransientPayload) { var ret map[string]interface{} return ret } @@ -242,15 +249,15 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetTransientPayload() map[string] // GetTransientPayloadOk returns a tuple with the TransientPayload field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithOidcMethod) GetTransientPayloadOk() (map[string]interface{}, bool) { - if o == nil || o.TransientPayload == nil { - return nil, false + if o == nil || IsNil(o.TransientPayload) { + return map[string]interface{}{}, false } return o.TransientPayload, true } // HasTransientPayload returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithOidcMethod) HasTransientPayload() bool { - if o != nil && o.TransientPayload != nil { + if o != nil && !IsNil(o.TransientPayload) { return true } @@ -264,7 +271,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) SetTransientPayload(v map[string] // GetUpstreamParameters returns the UpstreamParameters field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithOidcMethod) GetUpstreamParameters() map[string]interface{} { - if o == nil || o.UpstreamParameters == nil { + if o == nil || IsNil(o.UpstreamParameters) { var ret map[string]interface{} return ret } @@ -274,15 +281,15 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetUpstreamParameters() map[strin // GetUpstreamParametersOk returns a tuple with the UpstreamParameters field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithOidcMethod) GetUpstreamParametersOk() (map[string]interface{}, bool) { - if o == nil || o.UpstreamParameters == nil { - return nil, false + if o == nil || IsNil(o.UpstreamParameters) { + return map[string]interface{}{}, false } return o.UpstreamParameters, true } // HasUpstreamParameters returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithOidcMethod) HasUpstreamParameters() bool { - if o != nil && o.UpstreamParameters != nil { + if o != nil && !IsNil(o.UpstreamParameters) { return true } @@ -295,32 +302,74 @@ func (o *UpdateRegistrationFlowWithOidcMethod) SetUpstreamParameters(v map[strin } func (o UpdateRegistrationFlowWithOidcMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRegistrationFlowWithOidcMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if o.IdToken != nil { + if !IsNil(o.IdToken) { toSerialize["id_token"] = o.IdToken } - if o.IdTokenNonce != nil { + if !IsNil(o.IdTokenNonce) { toSerialize["id_token_nonce"] = o.IdTokenNonce } - if true { - toSerialize["method"] = o.Method - } - if true { - toSerialize["provider"] = o.Provider - } - if o.Traits != nil { + toSerialize["method"] = o.Method + toSerialize["provider"] = o.Provider + if !IsNil(o.Traits) { toSerialize["traits"] = o.Traits } - if o.TransientPayload != nil { + if !IsNil(o.TransientPayload) { toSerialize["transient_payload"] = o.TransientPayload } - if o.UpstreamParameters != nil { + if !IsNil(o.UpstreamParameters) { toSerialize["upstream_parameters"] = o.UpstreamParameters } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateRegistrationFlowWithOidcMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "provider", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateRegistrationFlowWithOidcMethod := _UpdateRegistrationFlowWithOidcMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateRegistrationFlowWithOidcMethod) + + if err != nil { + return err + } + + *o = UpdateRegistrationFlowWithOidcMethod(varUpdateRegistrationFlowWithOidcMethod) + + return err } type NullableUpdateRegistrationFlowWithOidcMethod struct { diff --git a/internal/client-go/model_update_registration_flow_with_password_method.go b/internal/client-go/model_update_registration_flow_with_password_method.go index 3a86a3002c88..b5395d031a2f 100644 --- a/internal/client-go/model_update_registration_flow_with_password_method.go +++ b/internal/client-go/model_update_registration_flow_with_password_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateRegistrationFlowWithPasswordMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRegistrationFlowWithPasswordMethod{} + // UpdateRegistrationFlowWithPasswordMethod Update Registration Flow with Password Method type UpdateRegistrationFlowWithPasswordMethod struct { // The CSRF Token @@ -29,6 +34,8 @@ type UpdateRegistrationFlowWithPasswordMethod struct { TransientPayload map[string]interface{} `json:"transient_payload,omitempty"` } +type _UpdateRegistrationFlowWithPasswordMethod UpdateRegistrationFlowWithPasswordMethod + // NewUpdateRegistrationFlowWithPasswordMethod instantiates a new UpdateRegistrationFlowWithPasswordMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -51,7 +58,7 @@ func NewUpdateRegistrationFlowWithPasswordMethodWithDefaults() *UpdateRegistrati // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithPasswordMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -61,7 +68,7 @@ func (o *UpdateRegistrationFlowWithPasswordMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithPasswordMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -69,7 +76,7 @@ func (o *UpdateRegistrationFlowWithPasswordMethod) GetCsrfTokenOk() (*string, bo // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithPasswordMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -143,7 +150,7 @@ func (o *UpdateRegistrationFlowWithPasswordMethod) GetTraits() map[string]interf // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithPasswordMethod) GetTraitsOk() (map[string]interface{}, bool) { if o == nil { - return nil, false + return map[string]interface{}{}, false } return o.Traits, true } @@ -155,7 +162,7 @@ func (o *UpdateRegistrationFlowWithPasswordMethod) SetTraits(v map[string]interf // GetTransientPayload returns the TransientPayload field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithPasswordMethod) GetTransientPayload() map[string]interface{} { - if o == nil || o.TransientPayload == nil { + if o == nil || IsNil(o.TransientPayload) { var ret map[string]interface{} return ret } @@ -165,15 +172,15 @@ func (o *UpdateRegistrationFlowWithPasswordMethod) GetTransientPayload() map[str // GetTransientPayloadOk returns a tuple with the TransientPayload field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithPasswordMethod) GetTransientPayloadOk() (map[string]interface{}, bool) { - if o == nil || o.TransientPayload == nil { - return nil, false + if o == nil || IsNil(o.TransientPayload) { + return map[string]interface{}{}, false } return o.TransientPayload, true } // HasTransientPayload returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithPasswordMethod) HasTransientPayload() bool { - if o != nil && o.TransientPayload != nil { + if o != nil && !IsNil(o.TransientPayload) { return true } @@ -186,23 +193,64 @@ func (o *UpdateRegistrationFlowWithPasswordMethod) SetTransientPayload(v map[str } func (o UpdateRegistrationFlowWithPasswordMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRegistrationFlowWithPasswordMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + toSerialize["password"] = o.Password + toSerialize["traits"] = o.Traits + if !IsNil(o.TransientPayload) { + toSerialize["transient_payload"] = o.TransientPayload } - if true { - toSerialize["password"] = o.Password + return toSerialize, nil +} + +func (o *UpdateRegistrationFlowWithPasswordMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "password", + "traits", } - if true { - toSerialize["traits"] = o.Traits + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if o.TransientPayload != nil { - toSerialize["transient_payload"] = o.TransientPayload + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varUpdateRegistrationFlowWithPasswordMethod := _UpdateRegistrationFlowWithPasswordMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateRegistrationFlowWithPasswordMethod) + + if err != nil { + return err + } + + *o = UpdateRegistrationFlowWithPasswordMethod(varUpdateRegistrationFlowWithPasswordMethod) + + return err } type NullableUpdateRegistrationFlowWithPasswordMethod struct { diff --git a/internal/client-go/model_update_registration_flow_with_web_authn_method.go b/internal/client-go/model_update_registration_flow_with_web_authn_method.go index 1249f645c0a1..3b38da142447 100644 --- a/internal/client-go/model_update_registration_flow_with_web_authn_method.go +++ b/internal/client-go/model_update_registration_flow_with_web_authn_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateRegistrationFlowWithWebAuthnMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRegistrationFlowWithWebAuthnMethod{} + // UpdateRegistrationFlowWithWebAuthnMethod Update Registration Flow with WebAuthn Method type UpdateRegistrationFlowWithWebAuthnMethod struct { // CSRFToken is the anti-CSRF token @@ -31,6 +36,8 @@ type UpdateRegistrationFlowWithWebAuthnMethod struct { WebauthnRegisterDisplayname *string `json:"webauthn_register_displayname,omitempty"` } +type _UpdateRegistrationFlowWithWebAuthnMethod UpdateRegistrationFlowWithWebAuthnMethod + // NewUpdateRegistrationFlowWithWebAuthnMethod instantiates a new UpdateRegistrationFlowWithWebAuthnMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -52,7 +59,7 @@ func NewUpdateRegistrationFlowWithWebAuthnMethodWithDefaults() *UpdateRegistrati // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -62,7 +69,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -70,7 +77,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetCsrfTokenOk() (*string, bo // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -120,7 +127,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetTraits() map[string]interf // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetTraitsOk() (map[string]interface{}, bool) { if o == nil { - return nil, false + return map[string]interface{}{}, false } return o.Traits, true } @@ -132,7 +139,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) SetTraits(v map[string]interf // GetTransientPayload returns the TransientPayload field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetTransientPayload() map[string]interface{} { - if o == nil || o.TransientPayload == nil { + if o == nil || IsNil(o.TransientPayload) { var ret map[string]interface{} return ret } @@ -142,15 +149,15 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetTransientPayload() map[str // GetTransientPayloadOk returns a tuple with the TransientPayload field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetTransientPayloadOk() (map[string]interface{}, bool) { - if o == nil || o.TransientPayload == nil { - return nil, false + if o == nil || IsNil(o.TransientPayload) { + return map[string]interface{}{}, false } return o.TransientPayload, true } // HasTransientPayload returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) HasTransientPayload() bool { - if o != nil && o.TransientPayload != nil { + if o != nil && !IsNil(o.TransientPayload) { return true } @@ -164,7 +171,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) SetTransientPayload(v map[str // GetWebauthnRegister returns the WebauthnRegister field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegister() string { - if o == nil || o.WebauthnRegister == nil { + if o == nil || IsNil(o.WebauthnRegister) { var ret string return ret } @@ -174,7 +181,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegister() string // GetWebauthnRegisterOk returns a tuple with the WebauthnRegister field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegisterOk() (*string, bool) { - if o == nil || o.WebauthnRegister == nil { + if o == nil || IsNil(o.WebauthnRegister) { return nil, false } return o.WebauthnRegister, true @@ -182,7 +189,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegisterOk() (*str // HasWebauthnRegister returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) HasWebauthnRegister() bool { - if o != nil && o.WebauthnRegister != nil { + if o != nil && !IsNil(o.WebauthnRegister) { return true } @@ -196,7 +203,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) SetWebauthnRegister(v string) // GetWebauthnRegisterDisplayname returns the WebauthnRegisterDisplayname field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegisterDisplayname() string { - if o == nil || o.WebauthnRegisterDisplayname == nil { + if o == nil || IsNil(o.WebauthnRegisterDisplayname) { var ret string return ret } @@ -206,7 +213,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegisterDisplaynam // GetWebauthnRegisterDisplaynameOk returns a tuple with the WebauthnRegisterDisplayname field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegisterDisplaynameOk() (*string, bool) { - if o == nil || o.WebauthnRegisterDisplayname == nil { + if o == nil || IsNil(o.WebauthnRegisterDisplayname) { return nil, false } return o.WebauthnRegisterDisplayname, true @@ -214,7 +221,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegisterDisplaynam // HasWebauthnRegisterDisplayname returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) HasWebauthnRegisterDisplayname() bool { - if o != nil && o.WebauthnRegisterDisplayname != nil { + if o != nil && !IsNil(o.WebauthnRegisterDisplayname) { return true } @@ -227,26 +234,68 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) SetWebauthnRegisterDisplaynam } func (o UpdateRegistrationFlowWithWebAuthnMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRegistrationFlowWithWebAuthnMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method - } - if true { - toSerialize["traits"] = o.Traits - } - if o.TransientPayload != nil { + toSerialize["method"] = o.Method + toSerialize["traits"] = o.Traits + if !IsNil(o.TransientPayload) { toSerialize["transient_payload"] = o.TransientPayload } - if o.WebauthnRegister != nil { + if !IsNil(o.WebauthnRegister) { toSerialize["webauthn_register"] = o.WebauthnRegister } - if o.WebauthnRegisterDisplayname != nil { + if !IsNil(o.WebauthnRegisterDisplayname) { toSerialize["webauthn_register_displayname"] = o.WebauthnRegisterDisplayname } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateRegistrationFlowWithWebAuthnMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "traits", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateRegistrationFlowWithWebAuthnMethod := _UpdateRegistrationFlowWithWebAuthnMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateRegistrationFlowWithWebAuthnMethod) + + if err != nil { + return err + } + + *o = UpdateRegistrationFlowWithWebAuthnMethod(varUpdateRegistrationFlowWithWebAuthnMethod) + + return err } type NullableUpdateRegistrationFlowWithWebAuthnMethod struct { diff --git a/internal/client-go/model_update_settings_flow_body.go b/internal/client-go/model_update_settings_flow_body.go index 064ff9b771dd..f7e0bac2f3f6 100644 --- a/internal/client-go/model_update_settings_flow_body.go +++ b/internal/client-go/model_update_settings_flow_body.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -159,11 +159,11 @@ func (dst *UpdateSettingsFlowBody) UnmarshalJSON(data []byte) error { dst.UpdateSettingsFlowWithTotpMethod = nil dst.UpdateSettingsFlowWithWebAuthnMethod = nil - return fmt.Errorf("Data matches more than one schema in oneOf(UpdateSettingsFlowBody)") + return fmt.Errorf("data matches more than one schema in oneOf(UpdateSettingsFlowBody)") } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(UpdateSettingsFlowBody)") + return fmt.Errorf("data failed to match schemas in oneOf(UpdateSettingsFlowBody)") } } diff --git a/internal/client-go/model_update_settings_flow_with_lookup_method.go b/internal/client-go/model_update_settings_flow_with_lookup_method.go index 96a12cb7f9e2..e3d84aa62fa3 100644 --- a/internal/client-go/model_update_settings_flow_with_lookup_method.go +++ b/internal/client-go/model_update_settings_flow_with_lookup_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateSettingsFlowWithLookupMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSettingsFlowWithLookupMethod{} + // UpdateSettingsFlowWithLookupMethod Update Settings Flow with Lookup Method type UpdateSettingsFlowWithLookupMethod struct { // CSRFToken is the anti-CSRF token @@ -31,6 +36,8 @@ type UpdateSettingsFlowWithLookupMethod struct { Method string `json:"method"` } +type _UpdateSettingsFlowWithLookupMethod UpdateSettingsFlowWithLookupMethod + // NewUpdateSettingsFlowWithLookupMethod instantiates a new UpdateSettingsFlowWithLookupMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -51,7 +58,7 @@ func NewUpdateSettingsFlowWithLookupMethodWithDefaults() *UpdateSettingsFlowWith // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithLookupMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -61,7 +68,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithLookupMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -69,7 +76,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithLookupMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -83,7 +90,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) SetCsrfToken(v string) { // GetLookupSecretConfirm returns the LookupSecretConfirm field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretConfirm() bool { - if o == nil || o.LookupSecretConfirm == nil { + if o == nil || IsNil(o.LookupSecretConfirm) { var ret bool return ret } @@ -93,7 +100,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretConfirm() bool { // GetLookupSecretConfirmOk returns a tuple with the LookupSecretConfirm field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretConfirmOk() (*bool, bool) { - if o == nil || o.LookupSecretConfirm == nil { + if o == nil || IsNil(o.LookupSecretConfirm) { return nil, false } return o.LookupSecretConfirm, true @@ -101,7 +108,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretConfirmOk() (*bool, // HasLookupSecretConfirm returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithLookupMethod) HasLookupSecretConfirm() bool { - if o != nil && o.LookupSecretConfirm != nil { + if o != nil && !IsNil(o.LookupSecretConfirm) { return true } @@ -115,7 +122,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) SetLookupSecretConfirm(v bool) { // GetLookupSecretDisable returns the LookupSecretDisable field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretDisable() bool { - if o == nil || o.LookupSecretDisable == nil { + if o == nil || IsNil(o.LookupSecretDisable) { var ret bool return ret } @@ -125,7 +132,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretDisable() bool { // GetLookupSecretDisableOk returns a tuple with the LookupSecretDisable field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretDisableOk() (*bool, bool) { - if o == nil || o.LookupSecretDisable == nil { + if o == nil || IsNil(o.LookupSecretDisable) { return nil, false } return o.LookupSecretDisable, true @@ -133,7 +140,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretDisableOk() (*bool, // HasLookupSecretDisable returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithLookupMethod) HasLookupSecretDisable() bool { - if o != nil && o.LookupSecretDisable != nil { + if o != nil && !IsNil(o.LookupSecretDisable) { return true } @@ -147,7 +154,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) SetLookupSecretDisable(v bool) { // GetLookupSecretRegenerate returns the LookupSecretRegenerate field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretRegenerate() bool { - if o == nil || o.LookupSecretRegenerate == nil { + if o == nil || IsNil(o.LookupSecretRegenerate) { var ret bool return ret } @@ -157,7 +164,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretRegenerate() bool { // GetLookupSecretRegenerateOk returns a tuple with the LookupSecretRegenerate field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretRegenerateOk() (*bool, bool) { - if o == nil || o.LookupSecretRegenerate == nil { + if o == nil || IsNil(o.LookupSecretRegenerate) { return nil, false } return o.LookupSecretRegenerate, true @@ -165,7 +172,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretRegenerateOk() (*boo // HasLookupSecretRegenerate returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithLookupMethod) HasLookupSecretRegenerate() bool { - if o != nil && o.LookupSecretRegenerate != nil { + if o != nil && !IsNil(o.LookupSecretRegenerate) { return true } @@ -179,7 +186,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) SetLookupSecretRegenerate(v bool) { // GetLookupSecretReveal returns the LookupSecretReveal field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretReveal() bool { - if o == nil || o.LookupSecretReveal == nil { + if o == nil || IsNil(o.LookupSecretReveal) { var ret bool return ret } @@ -189,7 +196,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretReveal() bool { // GetLookupSecretRevealOk returns a tuple with the LookupSecretReveal field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretRevealOk() (*bool, bool) { - if o == nil || o.LookupSecretReveal == nil { + if o == nil || IsNil(o.LookupSecretReveal) { return nil, false } return o.LookupSecretReveal, true @@ -197,7 +204,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretRevealOk() (*bool, b // HasLookupSecretReveal returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithLookupMethod) HasLookupSecretReveal() bool { - if o != nil && o.LookupSecretReveal != nil { + if o != nil && !IsNil(o.LookupSecretReveal) { return true } @@ -234,26 +241,69 @@ func (o *UpdateSettingsFlowWithLookupMethod) SetMethod(v string) { } func (o UpdateSettingsFlowWithLookupMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateSettingsFlowWithLookupMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if o.LookupSecretConfirm != nil { + if !IsNil(o.LookupSecretConfirm) { toSerialize["lookup_secret_confirm"] = o.LookupSecretConfirm } - if o.LookupSecretDisable != nil { + if !IsNil(o.LookupSecretDisable) { toSerialize["lookup_secret_disable"] = o.LookupSecretDisable } - if o.LookupSecretRegenerate != nil { + if !IsNil(o.LookupSecretRegenerate) { toSerialize["lookup_secret_regenerate"] = o.LookupSecretRegenerate } - if o.LookupSecretReveal != nil { + if !IsNil(o.LookupSecretReveal) { toSerialize["lookup_secret_reveal"] = o.LookupSecretReveal } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateSettingsFlowWithLookupMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateSettingsFlowWithLookupMethod := _UpdateSettingsFlowWithLookupMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateSettingsFlowWithLookupMethod) + + if err != nil { + return err + } + + *o = UpdateSettingsFlowWithLookupMethod(varUpdateSettingsFlowWithLookupMethod) + + return err } type NullableUpdateSettingsFlowWithLookupMethod struct { diff --git a/internal/client-go/model_update_settings_flow_with_oidc_method.go b/internal/client-go/model_update_settings_flow_with_oidc_method.go index 3008436d8b27..65cd9829ad61 100644 --- a/internal/client-go/model_update_settings_flow_with_oidc_method.go +++ b/internal/client-go/model_update_settings_flow_with_oidc_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateSettingsFlowWithOidcMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSettingsFlowWithOidcMethod{} + // UpdateSettingsFlowWithOidcMethod Update Settings Flow with OpenID Connect Method type UpdateSettingsFlowWithOidcMethod struct { // Flow ID is the flow's ID. in: query @@ -31,6 +36,8 @@ type UpdateSettingsFlowWithOidcMethod struct { UpstreamParameters map[string]interface{} `json:"upstream_parameters,omitempty"` } +type _UpdateSettingsFlowWithOidcMethod UpdateSettingsFlowWithOidcMethod + // NewUpdateSettingsFlowWithOidcMethod instantiates a new UpdateSettingsFlowWithOidcMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -51,7 +58,7 @@ func NewUpdateSettingsFlowWithOidcMethodWithDefaults() *UpdateSettingsFlowWithOi // GetFlow returns the Flow field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithOidcMethod) GetFlow() string { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { var ret string return ret } @@ -61,7 +68,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetFlow() string { // GetFlowOk returns a tuple with the Flow field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithOidcMethod) GetFlowOk() (*string, bool) { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { return nil, false } return o.Flow, true @@ -69,7 +76,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetFlowOk() (*string, bool) { // HasFlow returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithOidcMethod) HasFlow() bool { - if o != nil && o.Flow != nil { + if o != nil && !IsNil(o.Flow) { return true } @@ -83,7 +90,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) SetFlow(v string) { // GetLink returns the Link field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithOidcMethod) GetLink() string { - if o == nil || o.Link == nil { + if o == nil || IsNil(o.Link) { var ret string return ret } @@ -93,7 +100,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetLink() string { // GetLinkOk returns a tuple with the Link field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithOidcMethod) GetLinkOk() (*string, bool) { - if o == nil || o.Link == nil { + if o == nil || IsNil(o.Link) { return nil, false } return o.Link, true @@ -101,7 +108,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetLinkOk() (*string, bool) { // HasLink returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithOidcMethod) HasLink() bool { - if o != nil && o.Link != nil { + if o != nil && !IsNil(o.Link) { return true } @@ -139,7 +146,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) SetMethod(v string) { // GetTraits returns the Traits field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithOidcMethod) GetTraits() map[string]interface{} { - if o == nil || o.Traits == nil { + if o == nil || IsNil(o.Traits) { var ret map[string]interface{} return ret } @@ -149,15 +156,15 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetTraits() map[string]interface{} { // GetTraitsOk returns a tuple with the Traits field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithOidcMethod) GetTraitsOk() (map[string]interface{}, bool) { - if o == nil || o.Traits == nil { - return nil, false + if o == nil || IsNil(o.Traits) { + return map[string]interface{}{}, false } return o.Traits, true } // HasTraits returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithOidcMethod) HasTraits() bool { - if o != nil && o.Traits != nil { + if o != nil && !IsNil(o.Traits) { return true } @@ -171,7 +178,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) SetTraits(v map[string]interface{}) { // GetUnlink returns the Unlink field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithOidcMethod) GetUnlink() string { - if o == nil || o.Unlink == nil { + if o == nil || IsNil(o.Unlink) { var ret string return ret } @@ -181,7 +188,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetUnlink() string { // GetUnlinkOk returns a tuple with the Unlink field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithOidcMethod) GetUnlinkOk() (*string, bool) { - if o == nil || o.Unlink == nil { + if o == nil || IsNil(o.Unlink) { return nil, false } return o.Unlink, true @@ -189,7 +196,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetUnlinkOk() (*string, bool) { // HasUnlink returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithOidcMethod) HasUnlink() bool { - if o != nil && o.Unlink != nil { + if o != nil && !IsNil(o.Unlink) { return true } @@ -203,7 +210,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) SetUnlink(v string) { // GetUpstreamParameters returns the UpstreamParameters field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithOidcMethod) GetUpstreamParameters() map[string]interface{} { - if o == nil || o.UpstreamParameters == nil { + if o == nil || IsNil(o.UpstreamParameters) { var ret map[string]interface{} return ret } @@ -213,15 +220,15 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetUpstreamParameters() map[string]in // GetUpstreamParametersOk returns a tuple with the UpstreamParameters field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithOidcMethod) GetUpstreamParametersOk() (map[string]interface{}, bool) { - if o == nil || o.UpstreamParameters == nil { - return nil, false + if o == nil || IsNil(o.UpstreamParameters) { + return map[string]interface{}{}, false } return o.UpstreamParameters, true } // HasUpstreamParameters returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithOidcMethod) HasUpstreamParameters() bool { - if o != nil && o.UpstreamParameters != nil { + if o != nil && !IsNil(o.UpstreamParameters) { return true } @@ -234,26 +241,69 @@ func (o *UpdateSettingsFlowWithOidcMethod) SetUpstreamParameters(v map[string]in } func (o UpdateSettingsFlowWithOidcMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateSettingsFlowWithOidcMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Flow != nil { + if !IsNil(o.Flow) { toSerialize["flow"] = o.Flow } - if o.Link != nil { + if !IsNil(o.Link) { toSerialize["link"] = o.Link } - if true { - toSerialize["method"] = o.Method - } - if o.Traits != nil { + toSerialize["method"] = o.Method + if !IsNil(o.Traits) { toSerialize["traits"] = o.Traits } - if o.Unlink != nil { + if !IsNil(o.Unlink) { toSerialize["unlink"] = o.Unlink } - if o.UpstreamParameters != nil { + if !IsNil(o.UpstreamParameters) { toSerialize["upstream_parameters"] = o.UpstreamParameters } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateSettingsFlowWithOidcMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateSettingsFlowWithOidcMethod := _UpdateSettingsFlowWithOidcMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateSettingsFlowWithOidcMethod) + + if err != nil { + return err + } + + *o = UpdateSettingsFlowWithOidcMethod(varUpdateSettingsFlowWithOidcMethod) + + return err } type NullableUpdateSettingsFlowWithOidcMethod struct { diff --git a/internal/client-go/model_update_settings_flow_with_password_method.go b/internal/client-go/model_update_settings_flow_with_password_method.go index d4b9934756f0..83dadeac2e70 100644 --- a/internal/client-go/model_update_settings_flow_with_password_method.go +++ b/internal/client-go/model_update_settings_flow_with_password_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateSettingsFlowWithPasswordMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSettingsFlowWithPasswordMethod{} + // UpdateSettingsFlowWithPasswordMethod Update Settings Flow with Password Method type UpdateSettingsFlowWithPasswordMethod struct { // CSRFToken is the anti-CSRF token @@ -25,6 +30,8 @@ type UpdateSettingsFlowWithPasswordMethod struct { Password string `json:"password"` } +type _UpdateSettingsFlowWithPasswordMethod UpdateSettingsFlowWithPasswordMethod + // NewUpdateSettingsFlowWithPasswordMethod instantiates a new UpdateSettingsFlowWithPasswordMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -46,7 +53,7 @@ func NewUpdateSettingsFlowWithPasswordMethodWithDefaults() *UpdateSettingsFlowWi // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithPasswordMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -56,7 +63,7 @@ func (o *UpdateSettingsFlowWithPasswordMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithPasswordMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -64,7 +71,7 @@ func (o *UpdateSettingsFlowWithPasswordMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithPasswordMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -125,17 +132,59 @@ func (o *UpdateSettingsFlowWithPasswordMethod) SetPassword(v string) { } func (o UpdateSettingsFlowWithPasswordMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateSettingsFlowWithPasswordMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + toSerialize["password"] = o.Password + return toSerialize, nil +} + +func (o *UpdateSettingsFlowWithPasswordMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "password", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["password"] = o.Password + + varUpdateSettingsFlowWithPasswordMethod := _UpdateSettingsFlowWithPasswordMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateSettingsFlowWithPasswordMethod) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UpdateSettingsFlowWithPasswordMethod(varUpdateSettingsFlowWithPasswordMethod) + + return err } type NullableUpdateSettingsFlowWithPasswordMethod struct { diff --git a/internal/client-go/model_update_settings_flow_with_profile_method.go b/internal/client-go/model_update_settings_flow_with_profile_method.go index af2051f6c38c..b98d5b8a85f9 100644 --- a/internal/client-go/model_update_settings_flow_with_profile_method.go +++ b/internal/client-go/model_update_settings_flow_with_profile_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateSettingsFlowWithProfileMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSettingsFlowWithProfileMethod{} + // UpdateSettingsFlowWithProfileMethod Update Settings Flow with Profile Method type UpdateSettingsFlowWithProfileMethod struct { // The Anti-CSRF Token This token is only required when performing browser flows. @@ -25,6 +30,8 @@ type UpdateSettingsFlowWithProfileMethod struct { Traits map[string]interface{} `json:"traits"` } +type _UpdateSettingsFlowWithProfileMethod UpdateSettingsFlowWithProfileMethod + // NewUpdateSettingsFlowWithProfileMethod instantiates a new UpdateSettingsFlowWithProfileMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -46,7 +53,7 @@ func NewUpdateSettingsFlowWithProfileMethodWithDefaults() *UpdateSettingsFlowWit // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithProfileMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -56,7 +63,7 @@ func (o *UpdateSettingsFlowWithProfileMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithProfileMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -64,7 +71,7 @@ func (o *UpdateSettingsFlowWithProfileMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithProfileMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -114,7 +121,7 @@ func (o *UpdateSettingsFlowWithProfileMethod) GetTraits() map[string]interface{} // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithProfileMethod) GetTraitsOk() (map[string]interface{}, bool) { if o == nil { - return nil, false + return map[string]interface{}{}, false } return o.Traits, true } @@ -125,17 +132,59 @@ func (o *UpdateSettingsFlowWithProfileMethod) SetTraits(v map[string]interface{} } func (o UpdateSettingsFlowWithProfileMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateSettingsFlowWithProfileMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + toSerialize["traits"] = o.Traits + return toSerialize, nil +} + +func (o *UpdateSettingsFlowWithProfileMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "traits", } - if true { - toSerialize["traits"] = o.Traits + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateSettingsFlowWithProfileMethod := _UpdateSettingsFlowWithProfileMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateSettingsFlowWithProfileMethod) + + if err != nil { + return err + } + + *o = UpdateSettingsFlowWithProfileMethod(varUpdateSettingsFlowWithProfileMethod) + + return err } type NullableUpdateSettingsFlowWithProfileMethod struct { diff --git a/internal/client-go/model_update_settings_flow_with_totp_method.go b/internal/client-go/model_update_settings_flow_with_totp_method.go index 565f5d0e8a83..303b551af996 100644 --- a/internal/client-go/model_update_settings_flow_with_totp_method.go +++ b/internal/client-go/model_update_settings_flow_with_totp_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateSettingsFlowWithTotpMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSettingsFlowWithTotpMethod{} + // UpdateSettingsFlowWithTotpMethod Update Settings Flow with TOTP Method type UpdateSettingsFlowWithTotpMethod struct { // CSRFToken is the anti-CSRF token @@ -27,6 +32,8 @@ type UpdateSettingsFlowWithTotpMethod struct { TotpUnlink *bool `json:"totp_unlink,omitempty"` } +type _UpdateSettingsFlowWithTotpMethod UpdateSettingsFlowWithTotpMethod + // NewUpdateSettingsFlowWithTotpMethod instantiates a new UpdateSettingsFlowWithTotpMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -47,7 +54,7 @@ func NewUpdateSettingsFlowWithTotpMethodWithDefaults() *UpdateSettingsFlowWithTo // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithTotpMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -57,7 +64,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithTotpMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -65,7 +72,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithTotpMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -103,7 +110,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) SetMethod(v string) { // GetTotpCode returns the TotpCode field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithTotpMethod) GetTotpCode() string { - if o == nil || o.TotpCode == nil { + if o == nil || IsNil(o.TotpCode) { var ret string return ret } @@ -113,7 +120,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) GetTotpCode() string { // GetTotpCodeOk returns a tuple with the TotpCode field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithTotpMethod) GetTotpCodeOk() (*string, bool) { - if o == nil || o.TotpCode == nil { + if o == nil || IsNil(o.TotpCode) { return nil, false } return o.TotpCode, true @@ -121,7 +128,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) GetTotpCodeOk() (*string, bool) { // HasTotpCode returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithTotpMethod) HasTotpCode() bool { - if o != nil && o.TotpCode != nil { + if o != nil && !IsNil(o.TotpCode) { return true } @@ -135,7 +142,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) SetTotpCode(v string) { // GetTotpUnlink returns the TotpUnlink field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithTotpMethod) GetTotpUnlink() bool { - if o == nil || o.TotpUnlink == nil { + if o == nil || IsNil(o.TotpUnlink) { var ret bool return ret } @@ -145,7 +152,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) GetTotpUnlink() bool { // GetTotpUnlinkOk returns a tuple with the TotpUnlink field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithTotpMethod) GetTotpUnlinkOk() (*bool, bool) { - if o == nil || o.TotpUnlink == nil { + if o == nil || IsNil(o.TotpUnlink) { return nil, false } return o.TotpUnlink, true @@ -153,7 +160,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) GetTotpUnlinkOk() (*bool, bool) { // HasTotpUnlink returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithTotpMethod) HasTotpUnlink() bool { - if o != nil && o.TotpUnlink != nil { + if o != nil && !IsNil(o.TotpUnlink) { return true } @@ -166,20 +173,63 @@ func (o *UpdateSettingsFlowWithTotpMethod) SetTotpUnlink(v bool) { } func (o UpdateSettingsFlowWithTotpMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateSettingsFlowWithTotpMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method - } - if o.TotpCode != nil { + toSerialize["method"] = o.Method + if !IsNil(o.TotpCode) { toSerialize["totp_code"] = o.TotpCode } - if o.TotpUnlink != nil { + if !IsNil(o.TotpUnlink) { toSerialize["totp_unlink"] = o.TotpUnlink } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateSettingsFlowWithTotpMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateSettingsFlowWithTotpMethod := _UpdateSettingsFlowWithTotpMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateSettingsFlowWithTotpMethod) + + if err != nil { + return err + } + + *o = UpdateSettingsFlowWithTotpMethod(varUpdateSettingsFlowWithTotpMethod) + + return err } type NullableUpdateSettingsFlowWithTotpMethod struct { diff --git a/internal/client-go/model_update_settings_flow_with_web_authn_method.go b/internal/client-go/model_update_settings_flow_with_web_authn_method.go index 7bcd90c82e58..45bab10538a8 100644 --- a/internal/client-go/model_update_settings_flow_with_web_authn_method.go +++ b/internal/client-go/model_update_settings_flow_with_web_authn_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateSettingsFlowWithWebAuthnMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSettingsFlowWithWebAuthnMethod{} + // UpdateSettingsFlowWithWebAuthnMethod Update Settings Flow with WebAuthn Method type UpdateSettingsFlowWithWebAuthnMethod struct { // CSRFToken is the anti-CSRF token @@ -29,6 +34,8 @@ type UpdateSettingsFlowWithWebAuthnMethod struct { WebauthnRemove *string `json:"webauthn_remove,omitempty"` } +type _UpdateSettingsFlowWithWebAuthnMethod UpdateSettingsFlowWithWebAuthnMethod + // NewUpdateSettingsFlowWithWebAuthnMethod instantiates a new UpdateSettingsFlowWithWebAuthnMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -49,7 +56,7 @@ func NewUpdateSettingsFlowWithWebAuthnMethodWithDefaults() *UpdateSettingsFlowWi // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -59,7 +66,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -67,7 +74,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -105,7 +112,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) SetMethod(v string) { // GetWebauthnRegister returns the WebauthnRegister field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegister() string { - if o == nil || o.WebauthnRegister == nil { + if o == nil || IsNil(o.WebauthnRegister) { var ret string return ret } @@ -115,7 +122,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegister() string { // GetWebauthnRegisterOk returns a tuple with the WebauthnRegister field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegisterOk() (*string, bool) { - if o == nil || o.WebauthnRegister == nil { + if o == nil || IsNil(o.WebauthnRegister) { return nil, false } return o.WebauthnRegister, true @@ -123,7 +130,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegisterOk() (*string, // HasWebauthnRegister returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) HasWebauthnRegister() bool { - if o != nil && o.WebauthnRegister != nil { + if o != nil && !IsNil(o.WebauthnRegister) { return true } @@ -137,7 +144,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) SetWebauthnRegister(v string) { // GetWebauthnRegisterDisplayname returns the WebauthnRegisterDisplayname field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegisterDisplayname() string { - if o == nil || o.WebauthnRegisterDisplayname == nil { + if o == nil || IsNil(o.WebauthnRegisterDisplayname) { var ret string return ret } @@ -147,7 +154,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegisterDisplayname() // GetWebauthnRegisterDisplaynameOk returns a tuple with the WebauthnRegisterDisplayname field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegisterDisplaynameOk() (*string, bool) { - if o == nil || o.WebauthnRegisterDisplayname == nil { + if o == nil || IsNil(o.WebauthnRegisterDisplayname) { return nil, false } return o.WebauthnRegisterDisplayname, true @@ -155,7 +162,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegisterDisplaynameOk( // HasWebauthnRegisterDisplayname returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) HasWebauthnRegisterDisplayname() bool { - if o != nil && o.WebauthnRegisterDisplayname != nil { + if o != nil && !IsNil(o.WebauthnRegisterDisplayname) { return true } @@ -169,7 +176,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) SetWebauthnRegisterDisplayname(v // GetWebauthnRemove returns the WebauthnRemove field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRemove() string { - if o == nil || o.WebauthnRemove == nil { + if o == nil || IsNil(o.WebauthnRemove) { var ret string return ret } @@ -179,7 +186,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRemove() string { // GetWebauthnRemoveOk returns a tuple with the WebauthnRemove field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRemoveOk() (*string, bool) { - if o == nil || o.WebauthnRemove == nil { + if o == nil || IsNil(o.WebauthnRemove) { return nil, false } return o.WebauthnRemove, true @@ -187,7 +194,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRemoveOk() (*string, b // HasWebauthnRemove returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) HasWebauthnRemove() bool { - if o != nil && o.WebauthnRemove != nil { + if o != nil && !IsNil(o.WebauthnRemove) { return true } @@ -200,23 +207,66 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) SetWebauthnRemove(v string) { } func (o UpdateSettingsFlowWithWebAuthnMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateSettingsFlowWithWebAuthnMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method - } - if o.WebauthnRegister != nil { + toSerialize["method"] = o.Method + if !IsNil(o.WebauthnRegister) { toSerialize["webauthn_register"] = o.WebauthnRegister } - if o.WebauthnRegisterDisplayname != nil { + if !IsNil(o.WebauthnRegisterDisplayname) { toSerialize["webauthn_register_displayname"] = o.WebauthnRegisterDisplayname } - if o.WebauthnRemove != nil { + if !IsNil(o.WebauthnRemove) { toSerialize["webauthn_remove"] = o.WebauthnRemove } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateSettingsFlowWithWebAuthnMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateSettingsFlowWithWebAuthnMethod := _UpdateSettingsFlowWithWebAuthnMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateSettingsFlowWithWebAuthnMethod) + + if err != nil { + return err + } + + *o = UpdateSettingsFlowWithWebAuthnMethod(varUpdateSettingsFlowWithWebAuthnMethod) + + return err } type NullableUpdateSettingsFlowWithWebAuthnMethod struct { diff --git a/internal/client-go/model_update_verification_flow_body.go b/internal/client-go/model_update_verification_flow_body.go index f4e995d222c3..d587dc6a718e 100644 --- a/internal/client-go/model_update_verification_flow_body.go +++ b/internal/client-go/model_update_verification_flow_body.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -71,11 +71,11 @@ func (dst *UpdateVerificationFlowBody) UnmarshalJSON(data []byte) error { dst.UpdateVerificationFlowWithCodeMethod = nil dst.UpdateVerificationFlowWithLinkMethod = nil - return fmt.Errorf("Data matches more than one schema in oneOf(UpdateVerificationFlowBody)") + return fmt.Errorf("data matches more than one schema in oneOf(UpdateVerificationFlowBody)") } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(UpdateVerificationFlowBody)") + return fmt.Errorf("data failed to match schemas in oneOf(UpdateVerificationFlowBody)") } } diff --git a/internal/client-go/model_update_verification_flow_with_code_method.go b/internal/client-go/model_update_verification_flow_with_code_method.go index 4548425684b9..0ee2976d322f 100644 --- a/internal/client-go/model_update_verification_flow_with_code_method.go +++ b/internal/client-go/model_update_verification_flow_with_code_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateVerificationFlowWithCodeMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateVerificationFlowWithCodeMethod{} + // UpdateVerificationFlowWithCodeMethod struct for UpdateVerificationFlowWithCodeMethod type UpdateVerificationFlowWithCodeMethod struct { // Code from the recovery email If you want to submit a code, use this field, but make sure to _not_ include the email field, as well. @@ -27,6 +32,8 @@ type UpdateVerificationFlowWithCodeMethod struct { Method string `json:"method"` } +type _UpdateVerificationFlowWithCodeMethod UpdateVerificationFlowWithCodeMethod + // NewUpdateVerificationFlowWithCodeMethod instantiates a new UpdateVerificationFlowWithCodeMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -47,7 +54,7 @@ func NewUpdateVerificationFlowWithCodeMethodWithDefaults() *UpdateVerificationFl // GetCode returns the Code field value if set, zero value otherwise. func (o *UpdateVerificationFlowWithCodeMethod) GetCode() string { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { var ret string return ret } @@ -57,7 +64,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) GetCode() string { // GetCodeOk returns a tuple with the Code field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateVerificationFlowWithCodeMethod) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { return nil, false } return o.Code, true @@ -65,7 +72,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) GetCodeOk() (*string, bool) { // HasCode returns a boolean if a field has been set. func (o *UpdateVerificationFlowWithCodeMethod) HasCode() bool { - if o != nil && o.Code != nil { + if o != nil && !IsNil(o.Code) { return true } @@ -79,7 +86,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) SetCode(v string) { // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateVerificationFlowWithCodeMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -89,7 +96,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateVerificationFlowWithCodeMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -97,7 +104,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateVerificationFlowWithCodeMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -111,7 +118,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) SetCsrfToken(v string) { // GetEmail returns the Email field value if set, zero value otherwise. func (o *UpdateVerificationFlowWithCodeMethod) GetEmail() string { - if o == nil || o.Email == nil { + if o == nil || IsNil(o.Email) { var ret string return ret } @@ -121,7 +128,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) GetEmail() string { // GetEmailOk returns a tuple with the Email field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateVerificationFlowWithCodeMethod) GetEmailOk() (*string, bool) { - if o == nil || o.Email == nil { + if o == nil || IsNil(o.Email) { return nil, false } return o.Email, true @@ -129,7 +136,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) GetEmailOk() (*string, bool) { // HasEmail returns a boolean if a field has been set. func (o *UpdateVerificationFlowWithCodeMethod) HasEmail() bool { - if o != nil && o.Email != nil { + if o != nil && !IsNil(o.Email) { return true } @@ -166,20 +173,63 @@ func (o *UpdateVerificationFlowWithCodeMethod) SetMethod(v string) { } func (o UpdateVerificationFlowWithCodeMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateVerificationFlowWithCodeMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Code != nil { + if !IsNil(o.Code) { toSerialize["code"] = o.Code } - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if o.Email != nil { + if !IsNil(o.Email) { toSerialize["email"] = o.Email } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateVerificationFlowWithCodeMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateVerificationFlowWithCodeMethod := _UpdateVerificationFlowWithCodeMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateVerificationFlowWithCodeMethod) + + if err != nil { + return err + } + + *o = UpdateVerificationFlowWithCodeMethod(varUpdateVerificationFlowWithCodeMethod) + + return err } type NullableUpdateVerificationFlowWithCodeMethod struct { diff --git a/internal/client-go/model_update_verification_flow_with_link_method.go b/internal/client-go/model_update_verification_flow_with_link_method.go index 8ebbbd749952..c644218676b7 100644 --- a/internal/client-go/model_update_verification_flow_with_link_method.go +++ b/internal/client-go/model_update_verification_flow_with_link_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateVerificationFlowWithLinkMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateVerificationFlowWithLinkMethod{} + // UpdateVerificationFlowWithLinkMethod Update Verification Flow with Link Method type UpdateVerificationFlowWithLinkMethod struct { // Sending the anti-csrf token is only required for browser login flows. @@ -25,6 +30,8 @@ type UpdateVerificationFlowWithLinkMethod struct { Method string `json:"method"` } +type _UpdateVerificationFlowWithLinkMethod UpdateVerificationFlowWithLinkMethod + // NewUpdateVerificationFlowWithLinkMethod instantiates a new UpdateVerificationFlowWithLinkMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -46,7 +53,7 @@ func NewUpdateVerificationFlowWithLinkMethodWithDefaults() *UpdateVerificationFl // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateVerificationFlowWithLinkMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -56,7 +63,7 @@ func (o *UpdateVerificationFlowWithLinkMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateVerificationFlowWithLinkMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -64,7 +71,7 @@ func (o *UpdateVerificationFlowWithLinkMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateVerificationFlowWithLinkMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -125,17 +132,59 @@ func (o *UpdateVerificationFlowWithLinkMethod) SetMethod(v string) { } func (o UpdateVerificationFlowWithLinkMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateVerificationFlowWithLinkMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["email"] = o.Email + toSerialize["email"] = o.Email + toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateVerificationFlowWithLinkMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "email", + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["method"] = o.Method + + varUpdateVerificationFlowWithLinkMethod := _UpdateVerificationFlowWithLinkMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateVerificationFlowWithLinkMethod) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UpdateVerificationFlowWithLinkMethod(varUpdateVerificationFlowWithLinkMethod) + + return err } type NullableUpdateVerificationFlowWithLinkMethod struct { diff --git a/internal/client-go/model_verifiable_identity_address.go b/internal/client-go/model_verifiable_identity_address.go index 820881b2d3a2..a4e877b1399d 100644 --- a/internal/client-go/model_verifiable_identity_address.go +++ b/internal/client-go/model_verifiable_identity_address.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the VerifiableIdentityAddress type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VerifiableIdentityAddress{} + // VerifiableIdentityAddress VerifiableAddress is an identity's verifiable address type VerifiableIdentityAddress struct { // When this entry was created @@ -35,6 +40,8 @@ type VerifiableIdentityAddress struct { Via string `json:"via"` } +type _VerifiableIdentityAddress VerifiableIdentityAddress + // NewVerifiableIdentityAddress instantiates a new VerifiableIdentityAddress object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -58,7 +65,7 @@ func NewVerifiableIdentityAddressWithDefaults() *VerifiableIdentityAddress { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *VerifiableIdentityAddress) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -68,7 +75,7 @@ func (o *VerifiableIdentityAddress) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerifiableIdentityAddress) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -76,7 +83,7 @@ func (o *VerifiableIdentityAddress) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *VerifiableIdentityAddress) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -90,7 +97,7 @@ func (o *VerifiableIdentityAddress) SetCreatedAt(v time.Time) { // GetId returns the Id field value if set, zero value otherwise. func (o *VerifiableIdentityAddress) GetId() string { - if o == nil || o.Id == nil { + if o == nil || IsNil(o.Id) { var ret string return ret } @@ -100,7 +107,7 @@ func (o *VerifiableIdentityAddress) GetId() string { // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerifiableIdentityAddress) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { + if o == nil || IsNil(o.Id) { return nil, false } return o.Id, true @@ -108,7 +115,7 @@ func (o *VerifiableIdentityAddress) GetIdOk() (*string, bool) { // HasId returns a boolean if a field has been set. func (o *VerifiableIdentityAddress) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } @@ -146,7 +153,7 @@ func (o *VerifiableIdentityAddress) SetStatus(v string) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *VerifiableIdentityAddress) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -156,7 +163,7 @@ func (o *VerifiableIdentityAddress) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerifiableIdentityAddress) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -164,7 +171,7 @@ func (o *VerifiableIdentityAddress) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *VerifiableIdentityAddress) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -226,7 +233,7 @@ func (o *VerifiableIdentityAddress) SetVerified(v bool) { // GetVerifiedAt returns the VerifiedAt field value if set, zero value otherwise. func (o *VerifiableIdentityAddress) GetVerifiedAt() time.Time { - if o == nil || o.VerifiedAt == nil { + if o == nil || IsNil(o.VerifiedAt) { var ret time.Time return ret } @@ -236,7 +243,7 @@ func (o *VerifiableIdentityAddress) GetVerifiedAt() time.Time { // GetVerifiedAtOk returns a tuple with the VerifiedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerifiableIdentityAddress) GetVerifiedAtOk() (*time.Time, bool) { - if o == nil || o.VerifiedAt == nil { + if o == nil || IsNil(o.VerifiedAt) { return nil, false } return o.VerifiedAt, true @@ -244,7 +251,7 @@ func (o *VerifiableIdentityAddress) GetVerifiedAtOk() (*time.Time, bool) { // HasVerifiedAt returns a boolean if a field has been set. func (o *VerifiableIdentityAddress) HasVerifiedAt() bool { - if o != nil && o.VerifiedAt != nil { + if o != nil && !IsNil(o.VerifiedAt) { return true } @@ -281,32 +288,72 @@ func (o *VerifiableIdentityAddress) SetVia(v string) { } func (o VerifiableIdentityAddress) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VerifiableIdentityAddress) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - if true { - toSerialize["status"] = o.Status - } - if o.UpdatedAt != nil { + toSerialize["status"] = o.Status + if !IsNil(o.UpdatedAt) { toSerialize["updated_at"] = o.UpdatedAt } - if true { - toSerialize["value"] = o.Value + toSerialize["value"] = o.Value + toSerialize["verified"] = o.Verified + if !IsNil(o.VerifiedAt) { + toSerialize["verified_at"] = o.VerifiedAt } - if true { - toSerialize["verified"] = o.Verified + toSerialize["via"] = o.Via + return toSerialize, nil +} + +func (o *VerifiableIdentityAddress) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "status", + "value", + "verified", + "via", } - if o.VerifiedAt != nil { - toSerialize["verified_at"] = o.VerifiedAt + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["via"] = o.Via + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varVerifiableIdentityAddress := _VerifiableIdentityAddress{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varVerifiableIdentityAddress) + + if err != nil { + return err + } + + *o = VerifiableIdentityAddress(varVerifiableIdentityAddress) + + return err } type NullableVerifiableIdentityAddress struct { diff --git a/internal/client-go/model_verification_flow.go b/internal/client-go/model_verification_flow.go index c10870c9f841..5655b1916544 100644 --- a/internal/client-go/model_verification_flow.go +++ b/internal/client-go/model_verification_flow.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the VerificationFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VerificationFlow{} + // VerificationFlow Used to verify an out-of-band communication channel such as an email address or a phone number. For more information head over to: https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation type VerificationFlow struct { // Active, if set, contains the registration method that is being used. It is initially not set. @@ -37,6 +42,8 @@ type VerificationFlow struct { Ui UiContainer `json:"ui"` } +type _VerificationFlow VerificationFlow + // NewVerificationFlow instantiates a new VerificationFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -60,7 +67,7 @@ func NewVerificationFlowWithDefaults() *VerificationFlow { // GetActive returns the Active field value if set, zero value otherwise. func (o *VerificationFlow) GetActive() string { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { var ret string return ret } @@ -70,7 +77,7 @@ func (o *VerificationFlow) GetActive() string { // GetActiveOk returns a tuple with the Active field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerificationFlow) GetActiveOk() (*string, bool) { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { return nil, false } return o.Active, true @@ -78,7 +85,7 @@ func (o *VerificationFlow) GetActiveOk() (*string, bool) { // HasActive returns a boolean if a field has been set. func (o *VerificationFlow) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } @@ -92,7 +99,7 @@ func (o *VerificationFlow) SetActive(v string) { // GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. func (o *VerificationFlow) GetExpiresAt() time.Time { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { var ret time.Time return ret } @@ -102,7 +109,7 @@ func (o *VerificationFlow) GetExpiresAt() time.Time { // GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerificationFlow) GetExpiresAtOk() (*time.Time, bool) { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { return nil, false } return o.ExpiresAt, true @@ -110,7 +117,7 @@ func (o *VerificationFlow) GetExpiresAtOk() (*time.Time, bool) { // HasExpiresAt returns a boolean if a field has been set. func (o *VerificationFlow) HasExpiresAt() bool { - if o != nil && o.ExpiresAt != nil { + if o != nil && !IsNil(o.ExpiresAt) { return true } @@ -148,7 +155,7 @@ func (o *VerificationFlow) SetId(v string) { // GetIssuedAt returns the IssuedAt field value if set, zero value otherwise. func (o *VerificationFlow) GetIssuedAt() time.Time { - if o == nil || o.IssuedAt == nil { + if o == nil || IsNil(o.IssuedAt) { var ret time.Time return ret } @@ -158,7 +165,7 @@ func (o *VerificationFlow) GetIssuedAt() time.Time { // GetIssuedAtOk returns a tuple with the IssuedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerificationFlow) GetIssuedAtOk() (*time.Time, bool) { - if o == nil || o.IssuedAt == nil { + if o == nil || IsNil(o.IssuedAt) { return nil, false } return o.IssuedAt, true @@ -166,7 +173,7 @@ func (o *VerificationFlow) GetIssuedAtOk() (*time.Time, bool) { // HasIssuedAt returns a boolean if a field has been set. func (o *VerificationFlow) HasIssuedAt() bool { - if o != nil && o.IssuedAt != nil { + if o != nil && !IsNil(o.IssuedAt) { return true } @@ -180,7 +187,7 @@ func (o *VerificationFlow) SetIssuedAt(v time.Time) { // GetRequestUrl returns the RequestUrl field value if set, zero value otherwise. func (o *VerificationFlow) GetRequestUrl() string { - if o == nil || o.RequestUrl == nil { + if o == nil || IsNil(o.RequestUrl) { var ret string return ret } @@ -190,7 +197,7 @@ func (o *VerificationFlow) GetRequestUrl() string { // GetRequestUrlOk returns a tuple with the RequestUrl field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerificationFlow) GetRequestUrlOk() (*string, bool) { - if o == nil || o.RequestUrl == nil { + if o == nil || IsNil(o.RequestUrl) { return nil, false } return o.RequestUrl, true @@ -198,7 +205,7 @@ func (o *VerificationFlow) GetRequestUrlOk() (*string, bool) { // HasRequestUrl returns a boolean if a field has been set. func (o *VerificationFlow) HasRequestUrl() bool { - if o != nil && o.RequestUrl != nil { + if o != nil && !IsNil(o.RequestUrl) { return true } @@ -212,7 +219,7 @@ func (o *VerificationFlow) SetRequestUrl(v string) { // GetReturnTo returns the ReturnTo field value if set, zero value otherwise. func (o *VerificationFlow) GetReturnTo() string { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { var ret string return ret } @@ -222,7 +229,7 @@ func (o *VerificationFlow) GetReturnTo() string { // GetReturnToOk returns a tuple with the ReturnTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerificationFlow) GetReturnToOk() (*string, bool) { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { return nil, false } return o.ReturnTo, true @@ -230,7 +237,7 @@ func (o *VerificationFlow) GetReturnToOk() (*string, bool) { // HasReturnTo returns a boolean if a field has been set. func (o *VerificationFlow) HasReturnTo() bool { - if o != nil && o.ReturnTo != nil { + if o != nil && !IsNil(o.ReturnTo) { return true } @@ -257,7 +264,7 @@ func (o *VerificationFlow) GetState() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *VerificationFlow) GetStateOk() (*interface{}, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return &o.State, true @@ -317,35 +324,77 @@ func (o *VerificationFlow) SetUi(v UiContainer) { } func (o VerificationFlow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VerificationFlow) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - if o.ExpiresAt != nil { + if !IsNil(o.ExpiresAt) { toSerialize["expires_at"] = o.ExpiresAt } - if true { - toSerialize["id"] = o.Id - } - if o.IssuedAt != nil { + toSerialize["id"] = o.Id + if !IsNil(o.IssuedAt) { toSerialize["issued_at"] = o.IssuedAt } - if o.RequestUrl != nil { + if !IsNil(o.RequestUrl) { toSerialize["request_url"] = o.RequestUrl } - if o.ReturnTo != nil { + if !IsNil(o.ReturnTo) { toSerialize["return_to"] = o.ReturnTo } if o.State != nil { toSerialize["state"] = o.State } - if true { - toSerialize["type"] = o.Type + toSerialize["type"] = o.Type + toSerialize["ui"] = o.Ui + return toSerialize, nil +} + +func (o *VerificationFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "state", + "type", + "ui", } - if true { - toSerialize["ui"] = o.Ui + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVerificationFlow := _VerificationFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varVerificationFlow) + + if err != nil { + return err + } + + *o = VerificationFlow(varVerificationFlow) + + return err } type NullableVerificationFlow struct { diff --git a/internal/client-go/model_verification_flow_state.go b/internal/client-go/model_verification_flow_state.go index bea74568c94d..904585ab0edc 100644 --- a/internal/client-go/model_verification_flow_state.go +++ b/internal/client-go/model_verification_flow_state.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -26,6 +26,13 @@ const ( VERIFICATIONFLOWSTATE_PASSED_CHALLENGE VerificationFlowState = "passed_challenge" ) +// All allowed values of VerificationFlowState enum +var AllowedVerificationFlowStateEnumValues = []VerificationFlowState{ + "choose_method", + "sent_email", + "passed_challenge", +} + func (v *VerificationFlowState) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -33,7 +40,7 @@ func (v *VerificationFlowState) UnmarshalJSON(src []byte) error { return err } enumTypeValue := VerificationFlowState(value) - for _, existing := range []VerificationFlowState{"choose_method", "sent_email", "passed_challenge"} { + for _, existing := range AllowedVerificationFlowStateEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -43,6 +50,27 @@ func (v *VerificationFlowState) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid VerificationFlowState", value) } +// NewVerificationFlowStateFromValue returns a pointer to a valid VerificationFlowState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVerificationFlowStateFromValue(v string) (*VerificationFlowState, error) { + ev := VerificationFlowState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VerificationFlowState: valid values are %v", v, AllowedVerificationFlowStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VerificationFlowState) IsValid() bool { + for _, existing := range AllowedVerificationFlowStateEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to verificationFlowState value func (v VerificationFlowState) Ptr() *VerificationFlowState { return &v diff --git a/internal/client-go/model_version.go b/internal/client-go/model_version.go index 8df906ec237c..1e3beed44e37 100644 --- a/internal/client-go/model_version.go +++ b/internal/client-go/model_version.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the Version type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Version{} + // Version struct for Version type Version struct { // Version is the service's version. @@ -40,7 +43,7 @@ func NewVersionWithDefaults() *Version { // GetVersion returns the Version field value if set, zero value otherwise. func (o *Version) GetVersion() string { - if o == nil || o.Version == nil { + if o == nil || IsNil(o.Version) { var ret string return ret } @@ -50,7 +53,7 @@ func (o *Version) GetVersion() string { // GetVersionOk returns a tuple with the Version field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Version) GetVersionOk() (*string, bool) { - if o == nil || o.Version == nil { + if o == nil || IsNil(o.Version) { return nil, false } return o.Version, true @@ -58,7 +61,7 @@ func (o *Version) GetVersionOk() (*string, bool) { // HasVersion returns a boolean if a field has been set. func (o *Version) HasVersion() bool { - if o != nil && o.Version != nil { + if o != nil && !IsNil(o.Version) { return true } @@ -71,11 +74,19 @@ func (o *Version) SetVersion(v string) { } func (o Version) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Version) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Version != nil { + if !IsNil(o.Version) { toSerialize["version"] = o.Version } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableVersion struct { diff --git a/internal/client-go/response.go b/internal/client-go/response.go index 424806a6341c..50599b1354b5 100644 --- a/internal/client-go/response.go +++ b/internal/client-go/response.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -33,7 +33,7 @@ type APIResponse struct { Payload []byte `json:"-"` } -// NewAPIResponse returns a new APIResonse object. +// NewAPIResponse returns a new APIResponse object. func NewAPIResponse(r *http.Response) *APIResponse { response := &APIResponse{Response: r} diff --git a/internal/client-go/utils.go b/internal/client-go/utils.go index 3ac602a1d200..6d5271970a91 100644 --- a/internal/client-go/utils.go +++ b/internal/client-go/utils.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -13,6 +13,7 @@ package client import ( "encoding/json" + "reflect" "time" ) @@ -327,3 +328,21 @@ func (v *NullableTime) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} diff --git a/internal/httpclient/README.md b/internal/httpclient/README.md index 7f5de7166ef1..78b841a050ff 100644 --- a/internal/httpclient/README.md +++ b/internal/httpclient/README.md @@ -14,21 +14,20 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat Install the following dependencies: -```shell +```sh go get github.com/stretchr/testify/assert -go get golang.org/x/oauth2 go get golang.org/x/net/context ``` Put the package under your project folder and add the following in import: -```golang +```go import client "github.com/ory/client-go" ``` To use a proxy, set the environment variable `HTTP_PROXY`: -```golang +```go os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") ``` @@ -38,17 +37,17 @@ Default configuration comes with `Servers` field that contains server objects as ### Select Server Configuration -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. +For using other server than the one defined on index 0 set context value `client.ContextServerIndex` of type `int`. -```golang +```go ctx := context.WithValue(context.Background(), client.ContextServerIndex, 1) ``` ### Templated Server URL -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. +Templated server URL is formatted using default variables from configuration or from context value `client.ContextServerVariables` of type `map[string]string`. -```golang +```go ctx := context.WithValue(context.Background(), client.ContextServerVariables, map[string]string{ "basePath": "v2", }) @@ -59,10 +58,10 @@ Note, enum values are always validated and all unused variables are silently ign ### URLs Configuration per Operation Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. -An operation is uniquely identifield by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `client.ContextOperationServerIndices` and `client.ContextOperationServerVariables` context maps. -``` +```go ctx := context.WithValue(context.Background(), client.ContextOperationServerIndices, map[string]int{ "{classname}Service.{nickname}": 2, }) @@ -254,7 +253,7 @@ Class | Method | HTTP request | Description ## Documentation For Authorization - +Authentication schemes defined for the API: ### oryAccessToken - **Type**: API key @@ -263,6 +262,19 @@ Class | Method | HTTP request | Description Note, each API key must be added to a map of `map[string]APIKey` where the key is: Authorization and passed in as the auth context for each request. +Example + +```go +auth := context.WithValue( + context.Background(), + client.ContextAPIKeys, + map[string]client.APIKey{ + "Authorization": {Key: "API_KEY_STRING"}, + }, + ) +r, err := client.Service.Operation(auth, args) +``` + ## Documentation for Utility Methods diff --git a/internal/httpclient/api_courier.go b/internal/httpclient/api_courier.go index a7e43bcd183e..24ffc8fb1bc9 100644 --- a/internal/httpclient/api_courier.go +++ b/internal/httpclient/api_courier.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -20,83 +20,77 @@ import ( "strings" ) -// Linger please -var ( - _ context.Context -) - type CourierApi interface { /* - * GetCourierMessage Get a Message - * Gets a specific messages by the given ID. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id MessageID is the ID of the message. - * @return CourierApiApiGetCourierMessageRequest - */ - GetCourierMessage(ctx context.Context, id string) CourierApiApiGetCourierMessageRequest + GetCourierMessage Get a Message - /* - * GetCourierMessageExecute executes the request - * @return Message - */ - GetCourierMessageExecute(r CourierApiApiGetCourierMessageRequest) (*Message, *http.Response, error) + Gets a specific messages by the given ID. - /* - * ListCourierMessages List Messages - * Lists all messages by given status and recipient. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return CourierApiApiListCourierMessagesRequest - */ - ListCourierMessages(ctx context.Context) CourierApiApiListCourierMessagesRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id MessageID is the ID of the message. + @return CourierApiGetCourierMessageRequest + */ + GetCourierMessage(ctx context.Context, id string) CourierApiGetCourierMessageRequest + + // GetCourierMessageExecute executes the request + // @return Message + GetCourierMessageExecute(r CourierApiGetCourierMessageRequest) (*Message, *http.Response, error) /* - * ListCourierMessagesExecute executes the request - * @return []Message - */ - ListCourierMessagesExecute(r CourierApiApiListCourierMessagesRequest) ([]Message, *http.Response, error) + ListCourierMessages List Messages + + Lists all messages by given status and recipient. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return CourierApiListCourierMessagesRequest + */ + ListCourierMessages(ctx context.Context) CourierApiListCourierMessagesRequest + + // ListCourierMessagesExecute executes the request + // @return []Message + ListCourierMessagesExecute(r CourierApiListCourierMessagesRequest) ([]Message, *http.Response, error) } // CourierApiService CourierApi service type CourierApiService service -type CourierApiApiGetCourierMessageRequest struct { +type CourierApiGetCourierMessageRequest struct { ctx context.Context ApiService CourierApi id string } -func (r CourierApiApiGetCourierMessageRequest) Execute() (*Message, *http.Response, error) { +func (r CourierApiGetCourierMessageRequest) Execute() (*Message, *http.Response, error) { return r.ApiService.GetCourierMessageExecute(r) } /* - * GetCourierMessage Get a Message - * Gets a specific messages by the given ID. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id MessageID is the ID of the message. - * @return CourierApiApiGetCourierMessageRequest - */ -func (a *CourierApiService) GetCourierMessage(ctx context.Context, id string) CourierApiApiGetCourierMessageRequest { - return CourierApiApiGetCourierMessageRequest{ +GetCourierMessage Get a Message + +Gets a specific messages by the given ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id MessageID is the ID of the message. + @return CourierApiGetCourierMessageRequest +*/ +func (a *CourierApiService) GetCourierMessage(ctx context.Context, id string) CourierApiGetCourierMessageRequest { + return CourierApiGetCourierMessageRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return Message - */ -func (a *CourierApiService) GetCourierMessageExecute(r CourierApiApiGetCourierMessageRequest) (*Message, *http.Response, error) { +// Execute executes the request +// +// @return Message +func (a *CourierApiService) GetCourierMessageExecute(r CourierApiGetCourierMessageRequest) (*Message, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Message + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Message ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CourierApiService.GetCourierMessage") @@ -105,7 +99,7 @@ func (a *CourierApiService) GetCourierMessageExecute(r CourierApiApiGetCourierMe } localVarPath := localBasePath + "/admin/courier/messages/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -142,7 +136,7 @@ func (a *CourierApiService) GetCourierMessageExecute(r CourierApiApiGetCourierMe } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -171,6 +165,7 @@ func (a *CourierApiService) GetCourierMessageExecute(r CourierApiApiGetCourierMe newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -180,6 +175,7 @@ func (a *CourierApiService) GetCourierMessageExecute(r CourierApiApiGetCourierMe newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -196,7 +192,7 @@ func (a *CourierApiService) GetCourierMessageExecute(r CourierApiApiGetCourierMe return localVarReturnValue, localVarHTTPResponse, nil } -type CourierApiApiListCourierMessagesRequest struct { +type CourierApiListCourierMessagesRequest struct { ctx context.Context ApiService CourierApi pageSize *int64 @@ -205,52 +201,58 @@ type CourierApiApiListCourierMessagesRequest struct { recipient *string } -func (r CourierApiApiListCourierMessagesRequest) PageSize(pageSize int64) CourierApiApiListCourierMessagesRequest { +// Items per Page This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r CourierApiListCourierMessagesRequest) PageSize(pageSize int64) CourierApiListCourierMessagesRequest { r.pageSize = &pageSize return r } -func (r CourierApiApiListCourierMessagesRequest) PageToken(pageToken string) CourierApiApiListCourierMessagesRequest { + +// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r CourierApiListCourierMessagesRequest) PageToken(pageToken string) CourierApiListCourierMessagesRequest { r.pageToken = &pageToken return r } -func (r CourierApiApiListCourierMessagesRequest) Status(status CourierMessageStatus) CourierApiApiListCourierMessagesRequest { + +// Status filters out messages based on status. If no value is provided, it doesn't take effect on filter. +func (r CourierApiListCourierMessagesRequest) Status(status CourierMessageStatus) CourierApiListCourierMessagesRequest { r.status = &status return r } -func (r CourierApiApiListCourierMessagesRequest) Recipient(recipient string) CourierApiApiListCourierMessagesRequest { + +// Recipient filters out messages based on recipient. If no value is provided, it doesn't take effect on filter. +func (r CourierApiListCourierMessagesRequest) Recipient(recipient string) CourierApiListCourierMessagesRequest { r.recipient = &recipient return r } -func (r CourierApiApiListCourierMessagesRequest) Execute() ([]Message, *http.Response, error) { +func (r CourierApiListCourierMessagesRequest) Execute() ([]Message, *http.Response, error) { return r.ApiService.ListCourierMessagesExecute(r) } /* - * ListCourierMessages List Messages - * Lists all messages by given status and recipient. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return CourierApiApiListCourierMessagesRequest - */ -func (a *CourierApiService) ListCourierMessages(ctx context.Context) CourierApiApiListCourierMessagesRequest { - return CourierApiApiListCourierMessagesRequest{ +ListCourierMessages List Messages + +Lists all messages by given status and recipient. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return CourierApiListCourierMessagesRequest +*/ +func (a *CourierApiService) ListCourierMessages(ctx context.Context) CourierApiListCourierMessagesRequest { + return CourierApiListCourierMessagesRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return []Message - */ -func (a *CourierApiService) ListCourierMessagesExecute(r CourierApiApiListCourierMessagesRequest) ([]Message, *http.Response, error) { +// Execute executes the request +// +// @return []Message +func (a *CourierApiService) ListCourierMessagesExecute(r CourierApiListCourierMessagesRequest) ([]Message, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []Message + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Message ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CourierApiService.ListCourierMessages") @@ -265,16 +267,19 @@ func (a *CourierApiService) ListCourierMessagesExecute(r CourierApiApiListCourie localVarFormParams := url.Values{} if r.pageSize != nil { - localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "") + } else { + var defaultValue int64 = 250 + r.pageSize = &defaultValue } if r.pageToken != nil { - localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "") } if r.status != nil { - localVarQueryParams.Add("status", parameterToString(*r.status, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "status", r.status, "") } if r.recipient != nil { - localVarQueryParams.Add("recipient", parameterToString(*r.recipient, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "recipient", r.recipient, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -307,7 +312,7 @@ func (a *CourierApiService) ListCourierMessagesExecute(r CourierApiApiListCourie } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -336,6 +341,7 @@ func (a *CourierApiService) ListCourierMessagesExecute(r CourierApiApiListCourie newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -345,6 +351,7 @@ func (a *CourierApiService) ListCourierMessagesExecute(r CourierApiApiListCourie newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/internal/httpclient/api_frontend.go b/internal/httpclient/api_frontend.go index 94c0d05a6dba..b03b4003f07a 100644 --- a/internal/httpclient/api_frontend.go +++ b/internal/httpclient/api_frontend.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -20,16 +20,12 @@ import ( "strings" ) -// Linger please -var ( - _ context.Context -) - type FrontendApi interface { /* - * CreateBrowserLoginFlow Create Login Flow for Browsers - * This endpoint initializes a browser-based user login flow. This endpoint will set the appropriate + CreateBrowserLoginFlow Create Login Flow for Browsers + + This endpoint initializes a browser-based user login flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. If this endpoint is opened as a link in the browser, it will be redirected to @@ -52,20 +48,20 @@ type FrontendApi interface { This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateBrowserLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserLoginFlowRequest */ - CreateBrowserLoginFlow(ctx context.Context) FrontendApiApiCreateBrowserLoginFlowRequest + CreateBrowserLoginFlow(ctx context.Context) FrontendApiCreateBrowserLoginFlowRequest - /* - * CreateBrowserLoginFlowExecute executes the request - * @return LoginFlow - */ - CreateBrowserLoginFlowExecute(r FrontendApiApiCreateBrowserLoginFlowRequest) (*LoginFlow, *http.Response, error) + // CreateBrowserLoginFlowExecute executes the request + // @return LoginFlow + CreateBrowserLoginFlowExecute(r FrontendApiCreateBrowserLoginFlowRequest) (*LoginFlow, *http.Response, error) /* - * CreateBrowserLogoutFlow Create a Logout URL for Browsers - * This endpoint initializes a browser-based user logout flow and a URL which can be used to log out the user. + CreateBrowserLogoutFlow Create a Logout URL for Browsers + + This endpoint initializes a browser-based user logout flow and a URL which can be used to log out the user. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). For API clients you can @@ -75,20 +71,20 @@ type FrontendApi interface { a 401 error. When calling this endpoint from a backend, please ensure to properly forward the HTTP cookies. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateBrowserLogoutFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserLogoutFlowRequest */ - CreateBrowserLogoutFlow(ctx context.Context) FrontendApiApiCreateBrowserLogoutFlowRequest + CreateBrowserLogoutFlow(ctx context.Context) FrontendApiCreateBrowserLogoutFlowRequest - /* - * CreateBrowserLogoutFlowExecute executes the request - * @return LogoutFlow - */ - CreateBrowserLogoutFlowExecute(r FrontendApiApiCreateBrowserLogoutFlowRequest) (*LogoutFlow, *http.Response, error) + // CreateBrowserLogoutFlowExecute executes the request + // @return LogoutFlow + CreateBrowserLogoutFlowExecute(r FrontendApiCreateBrowserLogoutFlowRequest) (*LogoutFlow, *http.Response, error) /* - * CreateBrowserRecoveryFlow Create Recovery Flow for Browsers - * This endpoint initializes a browser-based account recovery flow. Once initialized, the browser will be redirected to + CreateBrowserRecoveryFlow Create Recovery Flow for Browsers + + This endpoint initializes a browser-based account recovery flow. Once initialized, the browser will be redirected to `selfservice.flows.recovery.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists, the browser is returned to the configured return URL. @@ -98,20 +94,20 @@ type FrontendApi interface { This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateBrowserRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserRecoveryFlowRequest */ - CreateBrowserRecoveryFlow(ctx context.Context) FrontendApiApiCreateBrowserRecoveryFlowRequest + CreateBrowserRecoveryFlow(ctx context.Context) FrontendApiCreateBrowserRecoveryFlowRequest - /* - * CreateBrowserRecoveryFlowExecute executes the request - * @return RecoveryFlow - */ - CreateBrowserRecoveryFlowExecute(r FrontendApiApiCreateBrowserRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) + // CreateBrowserRecoveryFlowExecute executes the request + // @return RecoveryFlow + CreateBrowserRecoveryFlowExecute(r FrontendApiCreateBrowserRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) /* - * CreateBrowserRegistrationFlow Create Registration Flow for Browsers - * This endpoint initializes a browser-based user registration flow. This endpoint will set the appropriate + CreateBrowserRegistrationFlow Create Registration Flow for Browsers + + This endpoint initializes a browser-based user registration flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. If this endpoint is opened as a link in the browser, it will be redirected to @@ -130,20 +126,20 @@ type FrontendApi interface { This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateBrowserRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserRegistrationFlowRequest */ - CreateBrowserRegistrationFlow(ctx context.Context) FrontendApiApiCreateBrowserRegistrationFlowRequest + CreateBrowserRegistrationFlow(ctx context.Context) FrontendApiCreateBrowserRegistrationFlowRequest - /* - * CreateBrowserRegistrationFlowExecute executes the request - * @return RegistrationFlow - */ - CreateBrowserRegistrationFlowExecute(r FrontendApiApiCreateBrowserRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) + // CreateBrowserRegistrationFlowExecute executes the request + // @return RegistrationFlow + CreateBrowserRegistrationFlowExecute(r FrontendApiCreateBrowserRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) /* - * CreateBrowserSettingsFlow Create Settings Flow for Browsers - * This endpoint initializes a browser-based user settings flow. Once initialized, the browser will be redirected to + CreateBrowserSettingsFlow Create Settings Flow for Browsers + + This endpoint initializes a browser-based user settings flow. Once initialized, the browser will be redirected to `selfservice.flows.settings.ui_url` with the flow ID set as the query parameter `?flow=`. If no valid Ory Kratos Session Cookie is included in the request, a login flow will be initialized. @@ -169,20 +165,20 @@ type FrontendApi interface { This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateBrowserSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserSettingsFlowRequest */ - CreateBrowserSettingsFlow(ctx context.Context) FrontendApiApiCreateBrowserSettingsFlowRequest + CreateBrowserSettingsFlow(ctx context.Context) FrontendApiCreateBrowserSettingsFlowRequest - /* - * CreateBrowserSettingsFlowExecute executes the request - * @return SettingsFlow - */ - CreateBrowserSettingsFlowExecute(r FrontendApiApiCreateBrowserSettingsFlowRequest) (*SettingsFlow, *http.Response, error) + // CreateBrowserSettingsFlowExecute executes the request + // @return SettingsFlow + CreateBrowserSettingsFlowExecute(r FrontendApiCreateBrowserSettingsFlowRequest) (*SettingsFlow, *http.Response, error) /* - * CreateBrowserVerificationFlow Create Verification Flow for Browser Clients - * This endpoint initializes a browser-based account verification flow. Once initialized, the browser will be redirected to + CreateBrowserVerificationFlow Create Verification Flow for Browser Clients + + This endpoint initializes a browser-based account verification flow. Once initialized, the browser will be redirected to `selfservice.flows.verification.ui_url` with the flow ID set as the query parameter `?flow=`. If this endpoint is called via an AJAX request, the response contains the recovery flow without any redirects. @@ -190,20 +186,20 @@ type FrontendApi interface { This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateBrowserVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserVerificationFlowRequest */ - CreateBrowserVerificationFlow(ctx context.Context) FrontendApiApiCreateBrowserVerificationFlowRequest + CreateBrowserVerificationFlow(ctx context.Context) FrontendApiCreateBrowserVerificationFlowRequest - /* - * CreateBrowserVerificationFlowExecute executes the request - * @return VerificationFlow - */ - CreateBrowserVerificationFlowExecute(r FrontendApiApiCreateBrowserVerificationFlowRequest) (*VerificationFlow, *http.Response, error) + // CreateBrowserVerificationFlowExecute executes the request + // @return VerificationFlow + CreateBrowserVerificationFlowExecute(r FrontendApiCreateBrowserVerificationFlowRequest) (*VerificationFlow, *http.Response, error) /* - * CreateNativeLoginFlow Create Login Flow for Native Apps - * This endpoint initiates a login flow for native apps that do not use a browser, such as mobile devices, smart TVs, and so on. + CreateNativeLoginFlow Create Login Flow for Native Apps + + This endpoint initiates a login flow for native apps that do not use a browser, such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. @@ -223,20 +219,20 @@ type FrontendApi interface { This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateNativeLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeLoginFlowRequest */ - CreateNativeLoginFlow(ctx context.Context) FrontendApiApiCreateNativeLoginFlowRequest + CreateNativeLoginFlow(ctx context.Context) FrontendApiCreateNativeLoginFlowRequest - /* - * CreateNativeLoginFlowExecute executes the request - * @return LoginFlow - */ - CreateNativeLoginFlowExecute(r FrontendApiApiCreateNativeLoginFlowRequest) (*LoginFlow, *http.Response, error) + // CreateNativeLoginFlowExecute executes the request + // @return LoginFlow + CreateNativeLoginFlowExecute(r FrontendApiCreateNativeLoginFlowRequest) (*LoginFlow, *http.Response, error) /* - * CreateNativeRecoveryFlow Create Recovery Flow for Native Apps - * This endpoint initiates a recovery flow for API clients such as mobile devices, smart TVs, and so on. + CreateNativeRecoveryFlow Create Recovery Flow for Native Apps + + This endpoint initiates a recovery flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error. @@ -249,20 +245,20 @@ type FrontendApi interface { This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateNativeRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeRecoveryFlowRequest */ - CreateNativeRecoveryFlow(ctx context.Context) FrontendApiApiCreateNativeRecoveryFlowRequest + CreateNativeRecoveryFlow(ctx context.Context) FrontendApiCreateNativeRecoveryFlowRequest - /* - * CreateNativeRecoveryFlowExecute executes the request - * @return RecoveryFlow - */ - CreateNativeRecoveryFlowExecute(r FrontendApiApiCreateNativeRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) + // CreateNativeRecoveryFlowExecute executes the request + // @return RecoveryFlow + CreateNativeRecoveryFlowExecute(r FrontendApiCreateNativeRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) /* - * CreateNativeRegistrationFlow Create Registration Flow for Native Apps - * This endpoint initiates a registration flow for API clients such as mobile devices, smart TVs, and so on. + CreateNativeRegistrationFlow Create Registration Flow for Native Apps + + This endpoint initiates a registration flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. @@ -281,20 +277,20 @@ type FrontendApi interface { This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateNativeRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeRegistrationFlowRequest */ - CreateNativeRegistrationFlow(ctx context.Context) FrontendApiApiCreateNativeRegistrationFlowRequest + CreateNativeRegistrationFlow(ctx context.Context) FrontendApiCreateNativeRegistrationFlowRequest - /* - * CreateNativeRegistrationFlowExecute executes the request - * @return RegistrationFlow - */ - CreateNativeRegistrationFlowExecute(r FrontendApiApiCreateNativeRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) + // CreateNativeRegistrationFlowExecute executes the request + // @return RegistrationFlow + CreateNativeRegistrationFlowExecute(r FrontendApiCreateNativeRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) /* - * CreateNativeSettingsFlow Create Settings Flow for Native Apps - * This endpoint initiates a settings flow for API clients such as mobile devices, smart TVs, and so on. + CreateNativeSettingsFlow Create Settings Flow for Native Apps + + This endpoint initiates a settings flow for API clients such as mobile devices, smart TVs, and so on. You must provide a valid Ory Kratos Session Token for this endpoint to respond with HTTP 200 OK. To fetch an existing settings flow call `/self-service/settings/flows?flow=`. @@ -316,20 +312,20 @@ type FrontendApi interface { This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateNativeSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeSettingsFlowRequest */ - CreateNativeSettingsFlow(ctx context.Context) FrontendApiApiCreateNativeSettingsFlowRequest + CreateNativeSettingsFlow(ctx context.Context) FrontendApiCreateNativeSettingsFlowRequest - /* - * CreateNativeSettingsFlowExecute executes the request - * @return SettingsFlow - */ - CreateNativeSettingsFlowExecute(r FrontendApiApiCreateNativeSettingsFlowRequest) (*SettingsFlow, *http.Response, error) + // CreateNativeSettingsFlowExecute executes the request + // @return SettingsFlow + CreateNativeSettingsFlowExecute(r FrontendApiCreateNativeSettingsFlowRequest) (*SettingsFlow, *http.Response, error) /* - * CreateNativeVerificationFlow Create Verification Flow for Native Apps - * This endpoint initiates a verification flow for API clients such as mobile devices, smart TVs, and so on. + CreateNativeVerificationFlow Create Verification Flow for Native Apps + + This endpoint initiates a verification flow for API clients such as mobile devices, smart TVs, and so on. To fetch an existing verification flow call `/self-service/verification/flows?flow=`. @@ -340,83 +336,82 @@ type FrontendApi interface { This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiCreateNativeVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeVerificationFlowRequest */ - CreateNativeVerificationFlow(ctx context.Context) FrontendApiApiCreateNativeVerificationFlowRequest + CreateNativeVerificationFlow(ctx context.Context) FrontendApiCreateNativeVerificationFlowRequest - /* - * CreateNativeVerificationFlowExecute executes the request - * @return VerificationFlow - */ - CreateNativeVerificationFlowExecute(r FrontendApiApiCreateNativeVerificationFlowRequest) (*VerificationFlow, *http.Response, error) + // CreateNativeVerificationFlowExecute executes the request + // @return VerificationFlow + CreateNativeVerificationFlowExecute(r FrontendApiCreateNativeVerificationFlowRequest) (*VerificationFlow, *http.Response, error) /* - * DisableMyOtherSessions Disable my other sessions - * Calling this endpoint invalidates all except the current session that belong to the logged-in user. + DisableMyOtherSessions Disable my other sessions + + Calling this endpoint invalidates all except the current session that belong to the logged-in user. Session data are not deleted. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiDisableMyOtherSessionsRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiDisableMyOtherSessionsRequest */ - DisableMyOtherSessions(ctx context.Context) FrontendApiApiDisableMyOtherSessionsRequest + DisableMyOtherSessions(ctx context.Context) FrontendApiDisableMyOtherSessionsRequest - /* - * DisableMyOtherSessionsExecute executes the request - * @return DeleteMySessionsCount - */ - DisableMyOtherSessionsExecute(r FrontendApiApiDisableMyOtherSessionsRequest) (*DeleteMySessionsCount, *http.Response, error) + // DisableMyOtherSessionsExecute executes the request + // @return DeleteMySessionsCount + DisableMyOtherSessionsExecute(r FrontendApiDisableMyOtherSessionsRequest) (*DeleteMySessionsCount, *http.Response, error) /* - * DisableMySession Disable one of my sessions - * Calling this endpoint invalidates the specified session. The current session cannot be revoked. + DisableMySession Disable one of my sessions + + Calling this endpoint invalidates the specified session. The current session cannot be revoked. Session data are not deleted. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the session's ID. - * @return FrontendApiApiDisableMySessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return FrontendApiDisableMySessionRequest */ - DisableMySession(ctx context.Context, id string) FrontendApiApiDisableMySessionRequest + DisableMySession(ctx context.Context, id string) FrontendApiDisableMySessionRequest - /* - * DisableMySessionExecute executes the request - */ - DisableMySessionExecute(r FrontendApiApiDisableMySessionRequest) (*http.Response, error) + // DisableMySessionExecute executes the request + DisableMySessionExecute(r FrontendApiDisableMySessionRequest) (*http.Response, error) /* - * ExchangeSessionToken Exchange Session Token - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiExchangeSessionTokenRequest - */ - ExchangeSessionToken(ctx context.Context) FrontendApiApiExchangeSessionTokenRequest + ExchangeSessionToken Exchange Session Token - /* - * ExchangeSessionTokenExecute executes the request - * @return SuccessfulNativeLogin - */ - ExchangeSessionTokenExecute(r FrontendApiApiExchangeSessionTokenRequest) (*SuccessfulNativeLogin, *http.Response, error) + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiExchangeSessionTokenRequest + */ + ExchangeSessionToken(ctx context.Context) FrontendApiExchangeSessionTokenRequest + + // ExchangeSessionTokenExecute executes the request + // @return SuccessfulNativeLogin + ExchangeSessionTokenExecute(r FrontendApiExchangeSessionTokenRequest) (*SuccessfulNativeLogin, *http.Response, error) /* - * GetFlowError Get User-Flow Errors - * This endpoint returns the error associated with a user-facing self service errors. + GetFlowError Get User-Flow Errors + + This endpoint returns the error associated with a user-facing self service errors. This endpoint supports stub values to help you implement the error UI: `?id=stub:500` - returns a stub 500 (Internal Server Error) error. More information can be found at [Ory Kratos User User Facing Error Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-facing-errors). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetFlowErrorRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetFlowErrorRequest */ - GetFlowError(ctx context.Context) FrontendApiApiGetFlowErrorRequest + GetFlowError(ctx context.Context) FrontendApiGetFlowErrorRequest - /* - * GetFlowErrorExecute executes the request - * @return FlowError - */ - GetFlowErrorExecute(r FrontendApiApiGetFlowErrorRequest) (*FlowError, *http.Response, error) + // GetFlowErrorExecute executes the request + // @return FlowError + GetFlowErrorExecute(r FrontendApiGetFlowErrorRequest) (*FlowError, *http.Response, error) /* - * GetLoginFlow Get Login Flow - * This endpoint returns a login flow's context with, for example, error details and other information. + GetLoginFlow Get Login Flow + + This endpoint returns a login flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -439,20 +434,20 @@ type FrontendApi interface { `self_service_flow_expired`: The flow is expired and you should request a new one. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetLoginFlowRequest */ - GetLoginFlow(ctx context.Context) FrontendApiApiGetLoginFlowRequest + GetLoginFlow(ctx context.Context) FrontendApiGetLoginFlowRequest - /* - * GetLoginFlowExecute executes the request - * @return LoginFlow - */ - GetLoginFlowExecute(r FrontendApiApiGetLoginFlowRequest) (*LoginFlow, *http.Response, error) + // GetLoginFlowExecute executes the request + // @return LoginFlow + GetLoginFlowExecute(r FrontendApiGetLoginFlowRequest) (*LoginFlow, *http.Response, error) /* - * GetRecoveryFlow Get Recovery Flow - * This endpoint returns a recovery flow's context with, for example, error details and other information. + GetRecoveryFlow Get Recovery Flow + + This endpoint returns a recovery flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -470,20 +465,20 @@ type FrontendApi interface { ``` More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetRecoveryFlowRequest */ - GetRecoveryFlow(ctx context.Context) FrontendApiApiGetRecoveryFlowRequest + GetRecoveryFlow(ctx context.Context) FrontendApiGetRecoveryFlowRequest - /* - * GetRecoveryFlowExecute executes the request - * @return RecoveryFlow - */ - GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) + // GetRecoveryFlowExecute executes the request + // @return RecoveryFlow + GetRecoveryFlowExecute(r FrontendApiGetRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) /* - * GetRegistrationFlow Get Registration Flow - * This endpoint returns a registration flow's context with, for example, error details and other information. + GetRegistrationFlow Get Registration Flow + + This endpoint returns a registration flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -506,20 +501,20 @@ type FrontendApi interface { `self_service_flow_expired`: The flow is expired and you should request a new one. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetRegistrationFlowRequest */ - GetRegistrationFlow(ctx context.Context) FrontendApiApiGetRegistrationFlowRequest + GetRegistrationFlow(ctx context.Context) FrontendApiGetRegistrationFlowRequest - /* - * GetRegistrationFlowExecute executes the request - * @return RegistrationFlow - */ - GetRegistrationFlowExecute(r FrontendApiApiGetRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) + // GetRegistrationFlowExecute executes the request + // @return RegistrationFlow + GetRegistrationFlowExecute(r FrontendApiGetRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) /* - * GetSettingsFlow Get Settings Flow - * When accessing this endpoint through Ory Kratos' Public API you must ensure that either the Ory Kratos Session Cookie + GetSettingsFlow Get Settings Flow + + When accessing this endpoint through Ory Kratos' Public API you must ensure that either the Ory Kratos Session Cookie or the Ory Kratos Session Token are set. Depending on your configuration this endpoint might return a 403 error if the session has a lower Authenticator @@ -538,20 +533,20 @@ type FrontendApi interface { identity logged in instead. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetSettingsFlowRequest */ - GetSettingsFlow(ctx context.Context) FrontendApiApiGetSettingsFlowRequest + GetSettingsFlow(ctx context.Context) FrontendApiGetSettingsFlowRequest - /* - * GetSettingsFlowExecute executes the request - * @return SettingsFlow - */ - GetSettingsFlowExecute(r FrontendApiApiGetSettingsFlowRequest) (*SettingsFlow, *http.Response, error) + // GetSettingsFlowExecute executes the request + // @return SettingsFlow + GetSettingsFlowExecute(r FrontendApiGetSettingsFlowRequest) (*SettingsFlow, *http.Response, error) /* - * GetVerificationFlow Get Verification Flow - * This endpoint returns a verification flow's context with, for example, error details and other information. + GetVerificationFlow Get Verification Flow + + This endpoint returns a verification flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -569,20 +564,20 @@ type FrontendApi interface { ``` More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetVerificationFlowRequest */ - GetVerificationFlow(ctx context.Context) FrontendApiApiGetVerificationFlowRequest + GetVerificationFlow(ctx context.Context) FrontendApiGetVerificationFlowRequest - /* - * GetVerificationFlowExecute executes the request - * @return VerificationFlow - */ - GetVerificationFlowExecute(r FrontendApiApiGetVerificationFlowRequest) (*VerificationFlow, *http.Response, error) + // GetVerificationFlowExecute executes the request + // @return VerificationFlow + GetVerificationFlowExecute(r FrontendApiGetVerificationFlowRequest) (*VerificationFlow, *http.Response, error) /* - * GetWebAuthnJavaScript Get WebAuthn JavaScript - * This endpoint provides JavaScript which is needed in order to perform WebAuthn login and registration. + GetWebAuthnJavaScript Get WebAuthn JavaScript + + This endpoint provides JavaScript which is needed in order to perform WebAuthn login and registration. If you are building a JavaScript Browser App (e.g. in ReactJS or AngularJS) you will need to load this file: @@ -591,35 +586,35 @@ type FrontendApi interface { ``` More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiGetWebAuthnJavaScriptRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetWebAuthnJavaScriptRequest */ - GetWebAuthnJavaScript(ctx context.Context) FrontendApiApiGetWebAuthnJavaScriptRequest + GetWebAuthnJavaScript(ctx context.Context) FrontendApiGetWebAuthnJavaScriptRequest - /* - * GetWebAuthnJavaScriptExecute executes the request - * @return string - */ - GetWebAuthnJavaScriptExecute(r FrontendApiApiGetWebAuthnJavaScriptRequest) (string, *http.Response, error) + // GetWebAuthnJavaScriptExecute executes the request + // @return string + GetWebAuthnJavaScriptExecute(r FrontendApiGetWebAuthnJavaScriptRequest) (string, *http.Response, error) /* - * ListMySessions Get My Active Sessions - * This endpoints returns all other active sessions that belong to the logged-in user. + ListMySessions Get My Active Sessions + + This endpoints returns all other active sessions that belong to the logged-in user. The current session can be retrieved by calling the `/sessions/whoami` endpoint. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiListMySessionsRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiListMySessionsRequest */ - ListMySessions(ctx context.Context) FrontendApiApiListMySessionsRequest + ListMySessions(ctx context.Context) FrontendApiListMySessionsRequest - /* - * ListMySessionsExecute executes the request - * @return []Session - */ - ListMySessionsExecute(r FrontendApiApiListMySessionsRequest) ([]Session, *http.Response, error) + // ListMySessionsExecute executes the request + // @return []Session + ListMySessionsExecute(r FrontendApiListMySessionsRequest) ([]Session, *http.Response, error) /* - * PerformNativeLogout Perform Logout for Native Apps - * Use this endpoint to log out an identity using an Ory Session Token. If the Ory Session Token was successfully + PerformNativeLogout Perform Logout for Native Apps + + Use this endpoint to log out an identity using an Ory Session Token. If the Ory Session Token was successfully revoked, the server returns a 204 No Content response. A 204 No Content response is also sent when the Ory Session Token has been revoked already before. @@ -627,19 +622,19 @@ type FrontendApi interface { This endpoint does not remove any HTTP Cookies - use the Browser-Based Self-Service Logout Flow instead. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiPerformNativeLogoutRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiPerformNativeLogoutRequest */ - PerformNativeLogout(ctx context.Context) FrontendApiApiPerformNativeLogoutRequest + PerformNativeLogout(ctx context.Context) FrontendApiPerformNativeLogoutRequest - /* - * PerformNativeLogoutExecute executes the request - */ - PerformNativeLogoutExecute(r FrontendApiApiPerformNativeLogoutRequest) (*http.Response, error) + // PerformNativeLogoutExecute executes the request + PerformNativeLogoutExecute(r FrontendApiPerformNativeLogoutRequest) (*http.Response, error) /* - * ToSession Check Who the Current HTTP Session Belongs To - * Uses the HTTP Headers in the GET request to determine (e.g. by using checking the cookies) who is authenticated. + ToSession Check Who the Current HTTP Session Belongs To + + Uses the HTTP Headers in the GET request to determine (e.g. by using checking the cookies) who is authenticated. Returns a session object in the body or 401 if the credentials are invalid or no credentials were sent. When the request it successful it adds the user ID to the 'X-Kratos-Authenticated-Identity-Id' header in the response. @@ -698,20 +693,20 @@ type FrontendApi interface { `session_inactive`: No active session was found in the request (e.g. no Ory Session Cookie / Ory Session Token). `session_aal2_required`: An active session was found but it does not fulfil the Authenticator Assurance Level, implying that the session must (e.g.) authenticate the second factor. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiToSessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiToSessionRequest */ - ToSession(ctx context.Context) FrontendApiApiToSessionRequest + ToSession(ctx context.Context) FrontendApiToSessionRequest - /* - * ToSessionExecute executes the request - * @return Session - */ - ToSessionExecute(r FrontendApiApiToSessionRequest) (*Session, *http.Response, error) + // ToSessionExecute executes the request + // @return Session + ToSessionExecute(r FrontendApiToSessionRequest) (*Session, *http.Response, error) /* - * UpdateLoginFlow Submit a Login Flow - * Use this endpoint to complete a login flow. This endpoint + UpdateLoginFlow Submit a Login Flow + + Use this endpoint to complete a login flow. This endpoint behaves differently for API and browser flows. API flows expect `application/json` to be sent in the body and responds with @@ -738,20 +733,20 @@ type FrontendApi interface { Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiUpdateLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateLoginFlowRequest */ - UpdateLoginFlow(ctx context.Context) FrontendApiApiUpdateLoginFlowRequest + UpdateLoginFlow(ctx context.Context) FrontendApiUpdateLoginFlowRequest - /* - * UpdateLoginFlowExecute executes the request - * @return SuccessfulNativeLogin - */ - UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginFlowRequest) (*SuccessfulNativeLogin, *http.Response, error) + // UpdateLoginFlowExecute executes the request + // @return SuccessfulNativeLogin + UpdateLoginFlowExecute(r FrontendApiUpdateLoginFlowRequest) (*SuccessfulNativeLogin, *http.Response, error) /* - * UpdateLogoutFlow Update Logout Flow - * This endpoint logs out an identity in a self-service manner. + UpdateLogoutFlow Update Logout Flow + + This endpoint logs out an identity in a self-service manner. If the `Accept` HTTP header is not set to `application/json`, the browser will be redirected (HTTP 303 See Other) to the `return_to` parameter of the initial request or fall back to `urls.default_return_to`. @@ -764,19 +759,19 @@ type FrontendApi interface { call the `/self-service/logout/api` URL directly with the Ory Session Token. More information can be found at [Ory Kratos User Logout Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-logout). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiUpdateLogoutFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateLogoutFlowRequest */ - UpdateLogoutFlow(ctx context.Context) FrontendApiApiUpdateLogoutFlowRequest + UpdateLogoutFlow(ctx context.Context) FrontendApiUpdateLogoutFlowRequest - /* - * UpdateLogoutFlowExecute executes the request - */ - UpdateLogoutFlowExecute(r FrontendApiApiUpdateLogoutFlowRequest) (*http.Response, error) + // UpdateLogoutFlowExecute executes the request + UpdateLogoutFlowExecute(r FrontendApiUpdateLogoutFlowRequest) (*http.Response, error) /* - * UpdateRecoveryFlow Update Recovery Flow - * Use this endpoint to update a recovery flow. This endpoint + UpdateRecoveryFlow Update Recovery Flow + + Use this endpoint to update a recovery flow. This endpoint behaves differently for API and browser flows and has several states: `choose_method` expects `flow` (in the URL query) and `email` (in the body) to be sent @@ -792,20 +787,20 @@ type FrontendApi interface { a new Recovery Flow ID which contains an error message that the recovery link was invalid. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiUpdateRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateRecoveryFlowRequest */ - UpdateRecoveryFlow(ctx context.Context) FrontendApiApiUpdateRecoveryFlowRequest + UpdateRecoveryFlow(ctx context.Context) FrontendApiUpdateRecoveryFlowRequest - /* - * UpdateRecoveryFlowExecute executes the request - * @return RecoveryFlow - */ - UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) + // UpdateRecoveryFlowExecute executes the request + // @return RecoveryFlow + UpdateRecoveryFlowExecute(r FrontendApiUpdateRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) /* - * UpdateRegistrationFlow Update Registration Flow - * Use this endpoint to complete a registration flow by sending an identity's traits and password. This endpoint + UpdateRegistrationFlow Update Registration Flow + + Use this endpoint to complete a registration flow by sending an identity's traits and password. This endpoint behaves differently for API and browser flows. API flows expect `application/json` to be sent in the body and respond with @@ -833,20 +828,20 @@ type FrontendApi interface { Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiUpdateRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateRegistrationFlowRequest */ - UpdateRegistrationFlow(ctx context.Context) FrontendApiApiUpdateRegistrationFlowRequest + UpdateRegistrationFlow(ctx context.Context) FrontendApiUpdateRegistrationFlowRequest - /* - * UpdateRegistrationFlowExecute executes the request - * @return SuccessfulNativeRegistration - */ - UpdateRegistrationFlowExecute(r FrontendApiApiUpdateRegistrationFlowRequest) (*SuccessfulNativeRegistration, *http.Response, error) + // UpdateRegistrationFlowExecute executes the request + // @return SuccessfulNativeRegistration + UpdateRegistrationFlowExecute(r FrontendApiUpdateRegistrationFlowRequest) (*SuccessfulNativeRegistration, *http.Response, error) /* - * UpdateSettingsFlow Complete Settings Flow - * Use this endpoint to complete a settings flow by sending an identity's updated password. This endpoint + UpdateSettingsFlow Complete Settings Flow + + Use this endpoint to complete a settings flow by sending an identity's updated password. This endpoint behaves differently for API and browser flows. API-initiated flows expect `application/json` to be sent in the body and respond with @@ -889,20 +884,20 @@ type FrontendApi interface { Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiUpdateSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateSettingsFlowRequest */ - UpdateSettingsFlow(ctx context.Context) FrontendApiApiUpdateSettingsFlowRequest + UpdateSettingsFlow(ctx context.Context) FrontendApiUpdateSettingsFlowRequest - /* - * UpdateSettingsFlowExecute executes the request - * @return SettingsFlow - */ - UpdateSettingsFlowExecute(r FrontendApiApiUpdateSettingsFlowRequest) (*SettingsFlow, *http.Response, error) + // UpdateSettingsFlowExecute executes the request + // @return SettingsFlow + UpdateSettingsFlowExecute(r FrontendApiUpdateSettingsFlowRequest) (*SettingsFlow, *http.Response, error) /* - * UpdateVerificationFlow Complete Verification Flow - * Use this endpoint to complete a verification flow. This endpoint + UpdateVerificationFlow Complete Verification Flow + + Use this endpoint to complete a verification flow. This endpoint behaves differently for API and browser flows and has several states: `choose_method` expects `flow` (in the URL query) and `email` (in the body) to be sent @@ -918,22 +913,21 @@ type FrontendApi interface { a new Verification Flow ID which contains an error message that the verification link was invalid. More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiUpdateVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateVerificationFlowRequest */ - UpdateVerificationFlow(ctx context.Context) FrontendApiApiUpdateVerificationFlowRequest + UpdateVerificationFlow(ctx context.Context) FrontendApiUpdateVerificationFlowRequest - /* - * UpdateVerificationFlowExecute executes the request - * @return VerificationFlow - */ - UpdateVerificationFlowExecute(r FrontendApiApiUpdateVerificationFlowRequest) (*VerificationFlow, *http.Response, error) + // UpdateVerificationFlowExecute executes the request + // @return VerificationFlow + UpdateVerificationFlowExecute(r FrontendApiUpdateVerificationFlowRequest) (*VerificationFlow, *http.Response, error) } // FrontendApiService FrontendApi service type FrontendApiService service -type FrontendApiApiCreateBrowserLoginFlowRequest struct { +type FrontendApiCreateBrowserLoginFlowRequest struct { ctx context.Context ApiService FrontendApi refresh *bool @@ -944,39 +938,50 @@ type FrontendApiApiCreateBrowserLoginFlowRequest struct { organization *string } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) Refresh(refresh bool) FrontendApiApiCreateBrowserLoginFlowRequest { +// Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session. +func (r FrontendApiCreateBrowserLoginFlowRequest) Refresh(refresh bool) FrontendApiCreateBrowserLoginFlowRequest { r.refresh = &refresh return r } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) Aal(aal string) FrontendApiApiCreateBrowserLoginFlowRequest { + +// Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session's authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session's security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\". +func (r FrontendApiCreateBrowserLoginFlowRequest) Aal(aal string) FrontendApiCreateBrowserLoginFlowRequest { r.aal = &aal return r } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateBrowserLoginFlowRequest { + +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateBrowserLoginFlowRequest) ReturnTo(returnTo string) FrontendApiCreateBrowserLoginFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) Cookie(cookie string) FrontendApiApiCreateBrowserLoginFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiCreateBrowserLoginFlowRequest) Cookie(cookie string) FrontendApiCreateBrowserLoginFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) LoginChallenge(loginChallenge string) FrontendApiApiCreateBrowserLoginFlowRequest { + +// An optional Hydra login challenge. If present, Kratos will cooperate with Ory Hydra to act as an OAuth2 identity provider. The value for this parameter comes from `login_challenge` URL Query parameter sent to your application (e.g. `/login?login_challenge=abcde`). +func (r FrontendApiCreateBrowserLoginFlowRequest) LoginChallenge(loginChallenge string) FrontendApiCreateBrowserLoginFlowRequest { r.loginChallenge = &loginChallenge return r } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) Organization(organization string) FrontendApiApiCreateBrowserLoginFlowRequest { + +// An optional organization ID that should be used for logging this user in. This parameter is only effective in the Ory Network. +func (r FrontendApiCreateBrowserLoginFlowRequest) Organization(organization string) FrontendApiCreateBrowserLoginFlowRequest { r.organization = &organization return r } -func (r FrontendApiApiCreateBrowserLoginFlowRequest) Execute() (*LoginFlow, *http.Response, error) { +func (r FrontendApiCreateBrowserLoginFlowRequest) Execute() (*LoginFlow, *http.Response, error) { return r.ApiService.CreateBrowserLoginFlowExecute(r) } /* - - CreateBrowserLoginFlow Create Login Flow for Browsers - - This endpoint initializes a browser-based user login flow. This endpoint will set the appropriate +CreateBrowserLoginFlow Create Login Flow for Browsers +This endpoint initializes a browser-based user login flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. If this endpoint is opened as a link in the browser, it will be redirected to @@ -999,28 +1004,26 @@ option. This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateBrowserLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserLoginFlowRequest */ -func (a *FrontendApiService) CreateBrowserLoginFlow(ctx context.Context) FrontendApiApiCreateBrowserLoginFlowRequest { - return FrontendApiApiCreateBrowserLoginFlowRequest{ +func (a *FrontendApiService) CreateBrowserLoginFlow(ctx context.Context) FrontendApiCreateBrowserLoginFlowRequest { + return FrontendApiCreateBrowserLoginFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return LoginFlow - */ -func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiApiCreateBrowserLoginFlowRequest) (*LoginFlow, *http.Response, error) { +// Execute executes the request +// +// @return LoginFlow +func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiCreateBrowserLoginFlowRequest) (*LoginFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *LoginFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LoginFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateBrowserLoginFlow") @@ -1035,19 +1038,19 @@ func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiApiCreat localVarFormParams := url.Values{} if r.refresh != nil { - localVarQueryParams.Add("refresh", parameterToString(*r.refresh, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "refresh", r.refresh, "") } if r.aal != nil { - localVarQueryParams.Add("aal", parameterToString(*r.aal, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "aal", r.aal, "") } if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } if r.loginChallenge != nil { - localVarQueryParams.Add("login_challenge", parameterToString(*r.loginChallenge, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "login_challenge", r.loginChallenge, "") } if r.organization != nil { - localVarQueryParams.Add("organization", parameterToString(*r.organization, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "organization", r.organization, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1067,9 +1070,9 @@ func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiApiCreat localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1098,6 +1101,7 @@ func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiApiCreat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1107,6 +1111,7 @@ func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiApiCreat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1123,29 +1128,33 @@ func (a *FrontendApiService) CreateBrowserLoginFlowExecute(r FrontendApiApiCreat return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateBrowserLogoutFlowRequest struct { +type FrontendApiCreateBrowserLogoutFlowRequest struct { ctx context.Context ApiService FrontendApi cookie *string returnTo *string } -func (r FrontendApiApiCreateBrowserLogoutFlowRequest) Cookie(cookie string) FrontendApiApiCreateBrowserLogoutFlowRequest { +// HTTP Cookies If you call this endpoint from a backend, please include the original Cookie header in the request. +func (r FrontendApiCreateBrowserLogoutFlowRequest) Cookie(cookie string) FrontendApiCreateBrowserLogoutFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiCreateBrowserLogoutFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateBrowserLogoutFlowRequest { + +// Return to URL The URL to which the browser should be redirected to after the logout has been performed. +func (r FrontendApiCreateBrowserLogoutFlowRequest) ReturnTo(returnTo string) FrontendApiCreateBrowserLogoutFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateBrowserLogoutFlowRequest) Execute() (*LogoutFlow, *http.Response, error) { +func (r FrontendApiCreateBrowserLogoutFlowRequest) Execute() (*LogoutFlow, *http.Response, error) { return r.ApiService.CreateBrowserLogoutFlowExecute(r) } /* - - CreateBrowserLogoutFlow Create a Logout URL for Browsers - - This endpoint initializes a browser-based user logout flow and a URL which can be used to log out the user. +CreateBrowserLogoutFlow Create a Logout URL for Browsers + +This endpoint initializes a browser-based user logout flow and a URL which can be used to log out the user. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). For API clients you can @@ -1155,28 +1164,26 @@ The URL is only valid for the currently signed in user. If no user is signed in, a 401 error. When calling this endpoint from a backend, please ensure to properly forward the HTTP cookies. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateBrowserLogoutFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserLogoutFlowRequest */ -func (a *FrontendApiService) CreateBrowserLogoutFlow(ctx context.Context) FrontendApiApiCreateBrowserLogoutFlowRequest { - return FrontendApiApiCreateBrowserLogoutFlowRequest{ +func (a *FrontendApiService) CreateBrowserLogoutFlow(ctx context.Context) FrontendApiCreateBrowserLogoutFlowRequest { + return FrontendApiCreateBrowserLogoutFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return LogoutFlow - */ -func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCreateBrowserLogoutFlowRequest) (*LogoutFlow, *http.Response, error) { +// Execute executes the request +// +// @return LogoutFlow +func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiCreateBrowserLogoutFlowRequest) (*LogoutFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *LogoutFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogoutFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateBrowserLogoutFlow") @@ -1191,7 +1198,7 @@ func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCrea localVarFormParams := url.Values{} if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1211,9 +1218,9 @@ func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCrea localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1242,6 +1249,7 @@ func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCrea newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1252,6 +1260,7 @@ func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCrea newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1262,6 +1271,7 @@ func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCrea newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr @@ -1279,25 +1289,26 @@ func (a *FrontendApiService) CreateBrowserLogoutFlowExecute(r FrontendApiApiCrea return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateBrowserRecoveryFlowRequest struct { +type FrontendApiCreateBrowserRecoveryFlowRequest struct { ctx context.Context ApiService FrontendApi returnTo *string } -func (r FrontendApiApiCreateBrowserRecoveryFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateBrowserRecoveryFlowRequest { +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateBrowserRecoveryFlowRequest) ReturnTo(returnTo string) FrontendApiCreateBrowserRecoveryFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateBrowserRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { +func (r FrontendApiCreateBrowserRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { return r.ApiService.CreateBrowserRecoveryFlowExecute(r) } /* - - CreateBrowserRecoveryFlow Create Recovery Flow for Browsers - - This endpoint initializes a browser-based account recovery flow. Once initialized, the browser will be redirected to +CreateBrowserRecoveryFlow Create Recovery Flow for Browsers +This endpoint initializes a browser-based account recovery flow. Once initialized, the browser will be redirected to `selfservice.flows.recovery.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists, the browser is returned to the configured return URL. @@ -1307,28 +1318,26 @@ or a 400 bad request error if the user is already authenticated. This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateBrowserRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserRecoveryFlowRequest */ -func (a *FrontendApiService) CreateBrowserRecoveryFlow(ctx context.Context) FrontendApiApiCreateBrowserRecoveryFlowRequest { - return FrontendApiApiCreateBrowserRecoveryFlowRequest{ +func (a *FrontendApiService) CreateBrowserRecoveryFlow(ctx context.Context) FrontendApiCreateBrowserRecoveryFlowRequest { + return FrontendApiCreateBrowserRecoveryFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RecoveryFlow - */ -func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiApiCreateBrowserRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { +// Execute executes the request +// +// @return RecoveryFlow +func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiCreateBrowserRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RecoveryFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateBrowserRecoveryFlow") @@ -1343,7 +1352,7 @@ func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiApiCr localVarFormParams := url.Values{} if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1362,7 +1371,7 @@ func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiApiCr if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1391,6 +1400,7 @@ func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiApiCr newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1400,6 +1410,7 @@ func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiApiCr newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1416,7 +1427,7 @@ func (a *FrontendApiService) CreateBrowserRecoveryFlowExecute(r FrontendApiApiCr return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateBrowserRegistrationFlowRequest struct { +type FrontendApiCreateBrowserRegistrationFlowRequest struct { ctx context.Context ApiService FrontendApi returnTo *string @@ -1425,31 +1436,37 @@ type FrontendApiApiCreateBrowserRegistrationFlowRequest struct { organization *string } -func (r FrontendApiApiCreateBrowserRegistrationFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateBrowserRegistrationFlowRequest { +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateBrowserRegistrationFlowRequest) ReturnTo(returnTo string) FrontendApiCreateBrowserRegistrationFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateBrowserRegistrationFlowRequest) LoginChallenge(loginChallenge string) FrontendApiApiCreateBrowserRegistrationFlowRequest { + +// Ory OAuth 2.0 Login Challenge. If set will cooperate with Ory OAuth2 and OpenID to act as an OAuth2 server / OpenID Provider. The value for this parameter comes from `login_challenge` URL Query parameter sent to your application (e.g. `/registration?login_challenge=abcde`). This feature is compatible with Ory Hydra when not running on the Ory Network. +func (r FrontendApiCreateBrowserRegistrationFlowRequest) LoginChallenge(loginChallenge string) FrontendApiCreateBrowserRegistrationFlowRequest { r.loginChallenge = &loginChallenge return r } -func (r FrontendApiApiCreateBrowserRegistrationFlowRequest) AfterVerificationReturnTo(afterVerificationReturnTo string) FrontendApiApiCreateBrowserRegistrationFlowRequest { + +// The URL to return the browser to after the verification flow was completed. After the registration flow is completed, the user will be sent a verification email. Upon completing the verification flow, this URL will be used to override the default `selfservice.flows.verification.after.default_redirect_to` value. +func (r FrontendApiCreateBrowserRegistrationFlowRequest) AfterVerificationReturnTo(afterVerificationReturnTo string) FrontendApiCreateBrowserRegistrationFlowRequest { r.afterVerificationReturnTo = &afterVerificationReturnTo return r } -func (r FrontendApiApiCreateBrowserRegistrationFlowRequest) Organization(organization string) FrontendApiApiCreateBrowserRegistrationFlowRequest { + +func (r FrontendApiCreateBrowserRegistrationFlowRequest) Organization(organization string) FrontendApiCreateBrowserRegistrationFlowRequest { r.organization = &organization return r } -func (r FrontendApiApiCreateBrowserRegistrationFlowRequest) Execute() (*RegistrationFlow, *http.Response, error) { +func (r FrontendApiCreateBrowserRegistrationFlowRequest) Execute() (*RegistrationFlow, *http.Response, error) { return r.ApiService.CreateBrowserRegistrationFlowExecute(r) } /* - - CreateBrowserRegistrationFlow Create Registration Flow for Browsers - - This endpoint initializes a browser-based user registration flow. This endpoint will set the appropriate +CreateBrowserRegistrationFlow Create Registration Flow for Browsers +This endpoint initializes a browser-based user registration flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. If this endpoint is opened as a link in the browser, it will be redirected to @@ -1468,28 +1485,26 @@ If this endpoint is called via an AJAX request, the response contains the regist This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateBrowserRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserRegistrationFlowRequest */ -func (a *FrontendApiService) CreateBrowserRegistrationFlow(ctx context.Context) FrontendApiApiCreateBrowserRegistrationFlowRequest { - return FrontendApiApiCreateBrowserRegistrationFlowRequest{ +func (a *FrontendApiService) CreateBrowserRegistrationFlow(ctx context.Context) FrontendApiCreateBrowserRegistrationFlowRequest { + return FrontendApiCreateBrowserRegistrationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RegistrationFlow - */ -func (a *FrontendApiService) CreateBrowserRegistrationFlowExecute(r FrontendApiApiCreateBrowserRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) { +// Execute executes the request +// +// @return RegistrationFlow +func (a *FrontendApiService) CreateBrowserRegistrationFlowExecute(r FrontendApiCreateBrowserRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RegistrationFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegistrationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateBrowserRegistrationFlow") @@ -1504,16 +1519,16 @@ func (a *FrontendApiService) CreateBrowserRegistrationFlowExecute(r FrontendApiA localVarFormParams := url.Values{} if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } if r.loginChallenge != nil { - localVarQueryParams.Add("login_challenge", parameterToString(*r.loginChallenge, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "login_challenge", r.loginChallenge, "") } if r.afterVerificationReturnTo != nil { - localVarQueryParams.Add("after_verification_return_to", parameterToString(*r.afterVerificationReturnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "after_verification_return_to", r.afterVerificationReturnTo, "") } if r.organization != nil { - localVarQueryParams.Add("organization", parameterToString(*r.organization, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "organization", r.organization, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1532,7 +1547,7 @@ func (a *FrontendApiService) CreateBrowserRegistrationFlowExecute(r FrontendApiA if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1560,6 +1575,7 @@ func (a *FrontendApiService) CreateBrowserRegistrationFlowExecute(r FrontendApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1576,30 +1592,33 @@ func (a *FrontendApiService) CreateBrowserRegistrationFlowExecute(r FrontendApiA return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateBrowserSettingsFlowRequest struct { +type FrontendApiCreateBrowserSettingsFlowRequest struct { ctx context.Context ApiService FrontendApi returnTo *string cookie *string } -func (r FrontendApiApiCreateBrowserSettingsFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateBrowserSettingsFlowRequest { +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateBrowserSettingsFlowRequest) ReturnTo(returnTo string) FrontendApiCreateBrowserSettingsFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateBrowserSettingsFlowRequest) Cookie(cookie string) FrontendApiApiCreateBrowserSettingsFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiCreateBrowserSettingsFlowRequest) Cookie(cookie string) FrontendApiCreateBrowserSettingsFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiCreateBrowserSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { +func (r FrontendApiCreateBrowserSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { return r.ApiService.CreateBrowserSettingsFlowExecute(r) } /* - - CreateBrowserSettingsFlow Create Settings Flow for Browsers - - This endpoint initializes a browser-based user settings flow. Once initialized, the browser will be redirected to +CreateBrowserSettingsFlow Create Settings Flow for Browsers +This endpoint initializes a browser-based user settings flow. Once initialized, the browser will be redirected to `selfservice.flows.settings.ui_url` with the flow ID set as the query parameter `?flow=`. If no valid Ory Kratos Session Cookie is included in the request, a login flow will be initialized. @@ -1625,28 +1644,26 @@ case of an error, the `error.id` of the JSON response body can be one of: This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateBrowserSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserSettingsFlowRequest */ -func (a *FrontendApiService) CreateBrowserSettingsFlow(ctx context.Context) FrontendApiApiCreateBrowserSettingsFlowRequest { - return FrontendApiApiCreateBrowserSettingsFlowRequest{ +func (a *FrontendApiService) CreateBrowserSettingsFlow(ctx context.Context) FrontendApiCreateBrowserSettingsFlowRequest { + return FrontendApiCreateBrowserSettingsFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SettingsFlow - */ -func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCreateBrowserSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { +// Execute executes the request +// +// @return SettingsFlow +func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiCreateBrowserSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SettingsFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SettingsFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateBrowserSettingsFlow") @@ -1661,7 +1678,7 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr localVarFormParams := url.Values{} if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1681,9 +1698,9 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1712,6 +1729,7 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1722,6 +1740,7 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1732,6 +1751,7 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1741,6 +1761,7 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1757,25 +1778,26 @@ func (a *FrontendApiService) CreateBrowserSettingsFlowExecute(r FrontendApiApiCr return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateBrowserVerificationFlowRequest struct { +type FrontendApiCreateBrowserVerificationFlowRequest struct { ctx context.Context ApiService FrontendApi returnTo *string } -func (r FrontendApiApiCreateBrowserVerificationFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateBrowserVerificationFlowRequest { +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateBrowserVerificationFlowRequest) ReturnTo(returnTo string) FrontendApiCreateBrowserVerificationFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateBrowserVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { +func (r FrontendApiCreateBrowserVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { return r.ApiService.CreateBrowserVerificationFlowExecute(r) } /* - - CreateBrowserVerificationFlow Create Verification Flow for Browser Clients - - This endpoint initializes a browser-based account verification flow. Once initialized, the browser will be redirected to +CreateBrowserVerificationFlow Create Verification Flow for Browser Clients +This endpoint initializes a browser-based account verification flow. Once initialized, the browser will be redirected to `selfservice.flows.verification.ui_url` with the flow ID set as the query parameter `?flow=`. If this endpoint is called via an AJAX request, the response contains the recovery flow without any redirects. @@ -1783,28 +1805,26 @@ If this endpoint is called via an AJAX request, the response contains the recove This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateBrowserVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateBrowserVerificationFlowRequest */ -func (a *FrontendApiService) CreateBrowserVerificationFlow(ctx context.Context) FrontendApiApiCreateBrowserVerificationFlowRequest { - return FrontendApiApiCreateBrowserVerificationFlowRequest{ +func (a *FrontendApiService) CreateBrowserVerificationFlow(ctx context.Context) FrontendApiCreateBrowserVerificationFlowRequest { + return FrontendApiCreateBrowserVerificationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return VerificationFlow - */ -func (a *FrontendApiService) CreateBrowserVerificationFlowExecute(r FrontendApiApiCreateBrowserVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { +// Execute executes the request +// +// @return VerificationFlow +func (a *FrontendApiService) CreateBrowserVerificationFlowExecute(r FrontendApiCreateBrowserVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *VerificationFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VerificationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateBrowserVerificationFlow") @@ -1819,7 +1839,7 @@ func (a *FrontendApiService) CreateBrowserVerificationFlowExecute(r FrontendApiA localVarFormParams := url.Values{} if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1838,7 +1858,7 @@ func (a *FrontendApiService) CreateBrowserVerificationFlowExecute(r FrontendApiA if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1866,6 +1886,7 @@ func (a *FrontendApiService) CreateBrowserVerificationFlowExecute(r FrontendApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1882,7 +1903,7 @@ func (a *FrontendApiService) CreateBrowserVerificationFlowExecute(r FrontendApiA return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateNativeLoginFlowRequest struct { +type FrontendApiCreateNativeLoginFlowRequest struct { ctx context.Context ApiService FrontendApi refresh *bool @@ -1893,38 +1914,50 @@ type FrontendApiApiCreateNativeLoginFlowRequest struct { via *string } -func (r FrontendApiApiCreateNativeLoginFlowRequest) Refresh(refresh bool) FrontendApiApiCreateNativeLoginFlowRequest { +// Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session. +func (r FrontendApiCreateNativeLoginFlowRequest) Refresh(refresh bool) FrontendApiCreateNativeLoginFlowRequest { r.refresh = &refresh return r } -func (r FrontendApiApiCreateNativeLoginFlowRequest) Aal(aal string) FrontendApiApiCreateNativeLoginFlowRequest { + +// Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session's authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session's security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\". +func (r FrontendApiCreateNativeLoginFlowRequest) Aal(aal string) FrontendApiCreateNativeLoginFlowRequest { r.aal = &aal return r } -func (r FrontendApiApiCreateNativeLoginFlowRequest) XSessionToken(xSessionToken string) FrontendApiApiCreateNativeLoginFlowRequest { + +// The Session Token of the Identity performing the settings flow. +func (r FrontendApiCreateNativeLoginFlowRequest) XSessionToken(xSessionToken string) FrontendApiCreateNativeLoginFlowRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiCreateNativeLoginFlowRequest) ReturnSessionTokenExchangeCode(returnSessionTokenExchangeCode bool) FrontendApiApiCreateNativeLoginFlowRequest { + +// EnableSessionTokenExchangeCode requests the login flow to include a code that can be used to retrieve the session token after the login flow has been completed. +func (r FrontendApiCreateNativeLoginFlowRequest) ReturnSessionTokenExchangeCode(returnSessionTokenExchangeCode bool) FrontendApiCreateNativeLoginFlowRequest { r.returnSessionTokenExchangeCode = &returnSessionTokenExchangeCode return r } -func (r FrontendApiApiCreateNativeLoginFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateNativeLoginFlowRequest { + +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateNativeLoginFlowRequest) ReturnTo(returnTo string) FrontendApiCreateNativeLoginFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateNativeLoginFlowRequest) Via(via string) FrontendApiApiCreateNativeLoginFlowRequest { + +// Via should contain the identity's credential the code should be sent to. Only relevant in aal2 flows. +func (r FrontendApiCreateNativeLoginFlowRequest) Via(via string) FrontendApiCreateNativeLoginFlowRequest { r.via = &via return r } -func (r FrontendApiApiCreateNativeLoginFlowRequest) Execute() (*LoginFlow, *http.Response, error) { +func (r FrontendApiCreateNativeLoginFlowRequest) Execute() (*LoginFlow, *http.Response, error) { return r.ApiService.CreateNativeLoginFlowExecute(r) } /* - - CreateNativeLoginFlow Create Login Flow for Native Apps - - This endpoint initiates a login flow for native apps that do not use a browser, such as mobile devices, smart TVs, and so on. +CreateNativeLoginFlow Create Login Flow for Native Apps + +This endpoint initiates a login flow for native apps that do not use a browser, such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. @@ -1944,28 +1977,26 @@ In the case of an error, the `error.id` of the JSON response body can be one of: This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateNativeLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeLoginFlowRequest */ -func (a *FrontendApiService) CreateNativeLoginFlow(ctx context.Context) FrontendApiApiCreateNativeLoginFlowRequest { - return FrontendApiApiCreateNativeLoginFlowRequest{ +func (a *FrontendApiService) CreateNativeLoginFlow(ctx context.Context) FrontendApiCreateNativeLoginFlowRequest { + return FrontendApiCreateNativeLoginFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return LoginFlow - */ -func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiApiCreateNativeLoginFlowRequest) (*LoginFlow, *http.Response, error) { +// Execute executes the request +// +// @return LoginFlow +func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiCreateNativeLoginFlowRequest) (*LoginFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *LoginFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LoginFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateNativeLoginFlow") @@ -1980,19 +2011,19 @@ func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiApiCreate localVarFormParams := url.Values{} if r.refresh != nil { - localVarQueryParams.Add("refresh", parameterToString(*r.refresh, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "refresh", r.refresh, "") } if r.aal != nil { - localVarQueryParams.Add("aal", parameterToString(*r.aal, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "aal", r.aal, "") } if r.returnSessionTokenExchangeCode != nil { - localVarQueryParams.Add("return_session_token_exchange_code", parameterToString(*r.returnSessionTokenExchangeCode, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_session_token_exchange_code", r.returnSessionTokenExchangeCode, "") } if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } if r.via != nil { - localVarQueryParams.Add("via", parameterToString(*r.via, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "via", r.via, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2012,9 +2043,9 @@ func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiApiCreate localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2043,6 +2074,7 @@ func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiApiCreate newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2052,6 +2084,7 @@ func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiApiCreate newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2068,18 +2101,19 @@ func (a *FrontendApiService) CreateNativeLoginFlowExecute(r FrontendApiApiCreate return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateNativeRecoveryFlowRequest struct { +type FrontendApiCreateNativeRecoveryFlowRequest struct { ctx context.Context ApiService FrontendApi } -func (r FrontendApiApiCreateNativeRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { +func (r FrontendApiCreateNativeRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { return r.ApiService.CreateNativeRecoveryFlowExecute(r) } /* - - CreateNativeRecoveryFlow Create Recovery Flow for Native Apps - - This endpoint initiates a recovery flow for API clients such as mobile devices, smart TVs, and so on. +CreateNativeRecoveryFlow Create Recovery Flow for Native Apps + +This endpoint initiates a recovery flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error. @@ -2092,28 +2126,26 @@ you vulnerable to a variety of CSRF attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateNativeRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeRecoveryFlowRequest */ -func (a *FrontendApiService) CreateNativeRecoveryFlow(ctx context.Context) FrontendApiApiCreateNativeRecoveryFlowRequest { - return FrontendApiApiCreateNativeRecoveryFlowRequest{ +func (a *FrontendApiService) CreateNativeRecoveryFlow(ctx context.Context) FrontendApiCreateNativeRecoveryFlowRequest { + return FrontendApiCreateNativeRecoveryFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RecoveryFlow - */ -func (a *FrontendApiService) CreateNativeRecoveryFlowExecute(r FrontendApiApiCreateNativeRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { +// Execute executes the request +// +// @return RecoveryFlow +func (a *FrontendApiService) CreateNativeRecoveryFlowExecute(r FrontendApiCreateNativeRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RecoveryFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateNativeRecoveryFlow") @@ -2144,7 +2176,7 @@ func (a *FrontendApiService) CreateNativeRecoveryFlowExecute(r FrontendApiApiCre if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2173,6 +2205,7 @@ func (a *FrontendApiService) CreateNativeRecoveryFlowExecute(r FrontendApiApiCre newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2182,6 +2215,7 @@ func (a *FrontendApiService) CreateNativeRecoveryFlowExecute(r FrontendApiApiCre newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2198,29 +2232,33 @@ func (a *FrontendApiService) CreateNativeRecoveryFlowExecute(r FrontendApiApiCre return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateNativeRegistrationFlowRequest struct { +type FrontendApiCreateNativeRegistrationFlowRequest struct { ctx context.Context ApiService FrontendApi returnSessionTokenExchangeCode *bool returnTo *string } -func (r FrontendApiApiCreateNativeRegistrationFlowRequest) ReturnSessionTokenExchangeCode(returnSessionTokenExchangeCode bool) FrontendApiApiCreateNativeRegistrationFlowRequest { +// EnableSessionTokenExchangeCode requests the login flow to include a code that can be used to retrieve the session token after the login flow has been completed. +func (r FrontendApiCreateNativeRegistrationFlowRequest) ReturnSessionTokenExchangeCode(returnSessionTokenExchangeCode bool) FrontendApiCreateNativeRegistrationFlowRequest { r.returnSessionTokenExchangeCode = &returnSessionTokenExchangeCode return r } -func (r FrontendApiApiCreateNativeRegistrationFlowRequest) ReturnTo(returnTo string) FrontendApiApiCreateNativeRegistrationFlowRequest { + +// The URL to return the browser to after the flow was completed. +func (r FrontendApiCreateNativeRegistrationFlowRequest) ReturnTo(returnTo string) FrontendApiCreateNativeRegistrationFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiCreateNativeRegistrationFlowRequest) Execute() (*RegistrationFlow, *http.Response, error) { +func (r FrontendApiCreateNativeRegistrationFlowRequest) Execute() (*RegistrationFlow, *http.Response, error) { return r.ApiService.CreateNativeRegistrationFlowExecute(r) } /* - - CreateNativeRegistrationFlow Create Registration Flow for Native Apps - - This endpoint initiates a registration flow for API clients such as mobile devices, smart TVs, and so on. +CreateNativeRegistrationFlow Create Registration Flow for Native Apps + +This endpoint initiates a registration flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. @@ -2239,28 +2277,26 @@ In the case of an error, the `error.id` of the JSON response body can be one of: This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateNativeRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeRegistrationFlowRequest */ -func (a *FrontendApiService) CreateNativeRegistrationFlow(ctx context.Context) FrontendApiApiCreateNativeRegistrationFlowRequest { - return FrontendApiApiCreateNativeRegistrationFlowRequest{ +func (a *FrontendApiService) CreateNativeRegistrationFlow(ctx context.Context) FrontendApiCreateNativeRegistrationFlowRequest { + return FrontendApiCreateNativeRegistrationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RegistrationFlow - */ -func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiApiCreateNativeRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) { +// Execute executes the request +// +// @return RegistrationFlow +func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiCreateNativeRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RegistrationFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegistrationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateNativeRegistrationFlow") @@ -2275,10 +2311,10 @@ func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiAp localVarFormParams := url.Values{} if r.returnSessionTokenExchangeCode != nil { - localVarQueryParams.Add("return_session_token_exchange_code", parameterToString(*r.returnSessionTokenExchangeCode, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_session_token_exchange_code", r.returnSessionTokenExchangeCode, "") } if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2297,7 +2333,7 @@ func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiAp if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2326,6 +2362,7 @@ func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiAp newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2335,6 +2372,7 @@ func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiAp newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2351,25 +2389,26 @@ func (a *FrontendApiService) CreateNativeRegistrationFlowExecute(r FrontendApiAp return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateNativeSettingsFlowRequest struct { +type FrontendApiCreateNativeSettingsFlowRequest struct { ctx context.Context ApiService FrontendApi xSessionToken *string } -func (r FrontendApiApiCreateNativeSettingsFlowRequest) XSessionToken(xSessionToken string) FrontendApiApiCreateNativeSettingsFlowRequest { +// The Session Token of the Identity performing the settings flow. +func (r FrontendApiCreateNativeSettingsFlowRequest) XSessionToken(xSessionToken string) FrontendApiCreateNativeSettingsFlowRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiCreateNativeSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { +func (r FrontendApiCreateNativeSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { return r.ApiService.CreateNativeSettingsFlowExecute(r) } /* - - CreateNativeSettingsFlow Create Settings Flow for Native Apps - - This endpoint initiates a settings flow for API clients such as mobile devices, smart TVs, and so on. +CreateNativeSettingsFlow Create Settings Flow for Native Apps +This endpoint initiates a settings flow for API clients such as mobile devices, smart TVs, and so on. You must provide a valid Ory Kratos Session Token for this endpoint to respond with HTTP 200 OK. To fetch an existing settings flow call `/self-service/settings/flows?flow=`. @@ -2391,28 +2430,26 @@ In the case of an error, the `error.id` of the JSON response body can be one of: This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateNativeSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeSettingsFlowRequest */ -func (a *FrontendApiService) CreateNativeSettingsFlow(ctx context.Context) FrontendApiApiCreateNativeSettingsFlowRequest { - return FrontendApiApiCreateNativeSettingsFlowRequest{ +func (a *FrontendApiService) CreateNativeSettingsFlow(ctx context.Context) FrontendApiCreateNativeSettingsFlowRequest { + return FrontendApiCreateNativeSettingsFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SettingsFlow - */ -func (a *FrontendApiService) CreateNativeSettingsFlowExecute(r FrontendApiApiCreateNativeSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { +// Execute executes the request +// +// @return SettingsFlow +func (a *FrontendApiService) CreateNativeSettingsFlowExecute(r FrontendApiCreateNativeSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SettingsFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SettingsFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateNativeSettingsFlow") @@ -2444,9 +2481,9 @@ func (a *FrontendApiService) CreateNativeSettingsFlowExecute(r FrontendApiApiCre localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2475,6 +2512,7 @@ func (a *FrontendApiService) CreateNativeSettingsFlowExecute(r FrontendApiApiCre newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2484,6 +2522,7 @@ func (a *FrontendApiService) CreateNativeSettingsFlowExecute(r FrontendApiApiCre newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2500,18 +2539,19 @@ func (a *FrontendApiService) CreateNativeSettingsFlowExecute(r FrontendApiApiCre return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiCreateNativeVerificationFlowRequest struct { +type FrontendApiCreateNativeVerificationFlowRequest struct { ctx context.Context ApiService FrontendApi } -func (r FrontendApiApiCreateNativeVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { +func (r FrontendApiCreateNativeVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { return r.ApiService.CreateNativeVerificationFlowExecute(r) } /* - - CreateNativeVerificationFlow Create Verification Flow for Native Apps - - This endpoint initiates a verification flow for API clients such as mobile devices, smart TVs, and so on. +CreateNativeVerificationFlow Create Verification Flow for Native Apps + +This endpoint initiates a verification flow for API clients such as mobile devices, smart TVs, and so on. To fetch an existing verification flow call `/self-service/verification/flows?flow=`. @@ -2522,28 +2562,26 @@ you vulnerable to a variety of CSRF attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiCreateNativeVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiCreateNativeVerificationFlowRequest */ -func (a *FrontendApiService) CreateNativeVerificationFlow(ctx context.Context) FrontendApiApiCreateNativeVerificationFlowRequest { - return FrontendApiApiCreateNativeVerificationFlowRequest{ +func (a *FrontendApiService) CreateNativeVerificationFlow(ctx context.Context) FrontendApiCreateNativeVerificationFlowRequest { + return FrontendApiCreateNativeVerificationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return VerificationFlow - */ -func (a *FrontendApiService) CreateNativeVerificationFlowExecute(r FrontendApiApiCreateNativeVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { +// Execute executes the request +// +// @return VerificationFlow +func (a *FrontendApiService) CreateNativeVerificationFlowExecute(r FrontendApiCreateNativeVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *VerificationFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VerificationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.CreateNativeVerificationFlow") @@ -2574,7 +2612,7 @@ func (a *FrontendApiService) CreateNativeVerificationFlowExecute(r FrontendApiAp if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2603,6 +2641,7 @@ func (a *FrontendApiService) CreateNativeVerificationFlowExecute(r FrontendApiAp newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2612,6 +2651,7 @@ func (a *FrontendApiService) CreateNativeVerificationFlowExecute(r FrontendApiAp newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2628,53 +2668,54 @@ func (a *FrontendApiService) CreateNativeVerificationFlowExecute(r FrontendApiAp return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiDisableMyOtherSessionsRequest struct { +type FrontendApiDisableMyOtherSessionsRequest struct { ctx context.Context ApiService FrontendApi xSessionToken *string cookie *string } -func (r FrontendApiApiDisableMyOtherSessionsRequest) XSessionToken(xSessionToken string) FrontendApiApiDisableMyOtherSessionsRequest { +// Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. +func (r FrontendApiDisableMyOtherSessionsRequest) XSessionToken(xSessionToken string) FrontendApiDisableMyOtherSessionsRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiDisableMyOtherSessionsRequest) Cookie(cookie string) FrontendApiApiDisableMyOtherSessionsRequest { + +// Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. +func (r FrontendApiDisableMyOtherSessionsRequest) Cookie(cookie string) FrontendApiDisableMyOtherSessionsRequest { r.cookie = &cookie return r } -func (r FrontendApiApiDisableMyOtherSessionsRequest) Execute() (*DeleteMySessionsCount, *http.Response, error) { +func (r FrontendApiDisableMyOtherSessionsRequest) Execute() (*DeleteMySessionsCount, *http.Response, error) { return r.ApiService.DisableMyOtherSessionsExecute(r) } /* - - DisableMyOtherSessions Disable my other sessions - - Calling this endpoint invalidates all except the current session that belong to the logged-in user. +DisableMyOtherSessions Disable my other sessions +Calling this endpoint invalidates all except the current session that belong to the logged-in user. Session data are not deleted. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiDisableMyOtherSessionsRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiDisableMyOtherSessionsRequest */ -func (a *FrontendApiService) DisableMyOtherSessions(ctx context.Context) FrontendApiApiDisableMyOtherSessionsRequest { - return FrontendApiApiDisableMyOtherSessionsRequest{ +func (a *FrontendApiService) DisableMyOtherSessions(ctx context.Context) FrontendApiDisableMyOtherSessionsRequest { + return FrontendApiDisableMyOtherSessionsRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return DeleteMySessionsCount - */ -func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiApiDisableMyOtherSessionsRequest) (*DeleteMySessionsCount, *http.Response, error) { +// Execute executes the request +// +// @return DeleteMySessionsCount +func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiDisableMyOtherSessionsRequest) (*DeleteMySessionsCount, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *DeleteMySessionsCount + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeleteMySessionsCount ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.DisableMyOtherSessions") @@ -2706,12 +2747,12 @@ func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiApiDisab localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2740,6 +2781,7 @@ func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiApiDisab newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2750,6 +2792,7 @@ func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiApiDisab newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2759,6 +2802,7 @@ func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiApiDisab newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2775,7 +2819,7 @@ func (a *FrontendApiService) DisableMyOtherSessionsExecute(r FrontendApiApiDisab return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiDisableMySessionRequest struct { +type FrontendApiDisableMySessionRequest struct { ctx context.Context ApiService FrontendApi id string @@ -2783,46 +2827,46 @@ type FrontendApiApiDisableMySessionRequest struct { cookie *string } -func (r FrontendApiApiDisableMySessionRequest) XSessionToken(xSessionToken string) FrontendApiApiDisableMySessionRequest { +// Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. +func (r FrontendApiDisableMySessionRequest) XSessionToken(xSessionToken string) FrontendApiDisableMySessionRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiDisableMySessionRequest) Cookie(cookie string) FrontendApiApiDisableMySessionRequest { + +// Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. +func (r FrontendApiDisableMySessionRequest) Cookie(cookie string) FrontendApiDisableMySessionRequest { r.cookie = &cookie return r } -func (r FrontendApiApiDisableMySessionRequest) Execute() (*http.Response, error) { +func (r FrontendApiDisableMySessionRequest) Execute() (*http.Response, error) { return r.ApiService.DisableMySessionExecute(r) } /* - - DisableMySession Disable one of my sessions - - Calling this endpoint invalidates the specified session. The current session cannot be revoked. +DisableMySession Disable one of my sessions +Calling this endpoint invalidates the specified session. The current session cannot be revoked. Session data are not deleted. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID is the session's ID. - - @return FrontendApiApiDisableMySessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return FrontendApiDisableMySessionRequest */ -func (a *FrontendApiService) DisableMySession(ctx context.Context, id string) FrontendApiApiDisableMySessionRequest { - return FrontendApiApiDisableMySessionRequest{ +func (a *FrontendApiService) DisableMySession(ctx context.Context, id string) FrontendApiDisableMySessionRequest { + return FrontendApiDisableMySessionRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - */ -func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySessionRequest) (*http.Response, error) { +// Execute executes the request +func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiDisableMySessionRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.DisableMySession") @@ -2831,7 +2875,7 @@ func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySe } localVarPath := localBasePath + "/sessions/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2855,12 +2899,12 @@ func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -2889,6 +2933,7 @@ func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySe newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -2899,6 +2944,7 @@ func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySe newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -2908,6 +2954,7 @@ func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySe newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -2915,50 +2962,51 @@ func (a *FrontendApiService) DisableMySessionExecute(r FrontendApiApiDisableMySe return localVarHTTPResponse, nil } -type FrontendApiApiExchangeSessionTokenRequest struct { +type FrontendApiExchangeSessionTokenRequest struct { ctx context.Context ApiService FrontendApi initCode *string returnToCode *string } -func (r FrontendApiApiExchangeSessionTokenRequest) InitCode(initCode string) FrontendApiApiExchangeSessionTokenRequest { +// The part of the code return when initializing the flow. +func (r FrontendApiExchangeSessionTokenRequest) InitCode(initCode string) FrontendApiExchangeSessionTokenRequest { r.initCode = &initCode return r } -func (r FrontendApiApiExchangeSessionTokenRequest) ReturnToCode(returnToCode string) FrontendApiApiExchangeSessionTokenRequest { + +// The part of the code returned by the return_to URL. +func (r FrontendApiExchangeSessionTokenRequest) ReturnToCode(returnToCode string) FrontendApiExchangeSessionTokenRequest { r.returnToCode = &returnToCode return r } -func (r FrontendApiApiExchangeSessionTokenRequest) Execute() (*SuccessfulNativeLogin, *http.Response, error) { +func (r FrontendApiExchangeSessionTokenRequest) Execute() (*SuccessfulNativeLogin, *http.Response, error) { return r.ApiService.ExchangeSessionTokenExecute(r) } /* - * ExchangeSessionToken Exchange Session Token - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return FrontendApiApiExchangeSessionTokenRequest - */ -func (a *FrontendApiService) ExchangeSessionToken(ctx context.Context) FrontendApiApiExchangeSessionTokenRequest { - return FrontendApiApiExchangeSessionTokenRequest{ +ExchangeSessionToken Exchange Session Token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiExchangeSessionTokenRequest +*/ +func (a *FrontendApiService) ExchangeSessionToken(ctx context.Context) FrontendApiExchangeSessionTokenRequest { + return FrontendApiExchangeSessionTokenRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SuccessfulNativeLogin - */ -func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchangeSessionTokenRequest) (*SuccessfulNativeLogin, *http.Response, error) { +// Execute executes the request +// +// @return SuccessfulNativeLogin +func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiExchangeSessionTokenRequest) (*SuccessfulNativeLogin, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SuccessfulNativeLogin + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SuccessfulNativeLogin ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.ExchangeSessionToken") @@ -2978,8 +3026,8 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang return localVarReturnValue, nil, reportError("returnToCode is required and must be specified") } - localVarQueryParams.Add("init_code", parameterToString(*r.initCode, "")) - localVarQueryParams.Add("return_to_code", parameterToString(*r.returnToCode, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "init_code", r.initCode, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to_code", r.returnToCode, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2997,7 +3045,7 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3026,6 +3074,7 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3036,6 +3085,7 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3046,6 +3096,7 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3055,6 +3106,7 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3071,52 +3123,52 @@ func (a *FrontendApiService) ExchangeSessionTokenExecute(r FrontendApiApiExchang return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetFlowErrorRequest struct { +type FrontendApiGetFlowErrorRequest struct { ctx context.Context ApiService FrontendApi id *string } -func (r FrontendApiApiGetFlowErrorRequest) Id(id string) FrontendApiApiGetFlowErrorRequest { +// Error is the error's ID +func (r FrontendApiGetFlowErrorRequest) Id(id string) FrontendApiGetFlowErrorRequest { r.id = &id return r } -func (r FrontendApiApiGetFlowErrorRequest) Execute() (*FlowError, *http.Response, error) { +func (r FrontendApiGetFlowErrorRequest) Execute() (*FlowError, *http.Response, error) { return r.ApiService.GetFlowErrorExecute(r) } /* - - GetFlowError Get User-Flow Errors - - This endpoint returns the error associated with a user-facing self service errors. +GetFlowError Get User-Flow Errors + +This endpoint returns the error associated with a user-facing self service errors. This endpoint supports stub values to help you implement the error UI: `?id=stub:500` - returns a stub 500 (Internal Server Error) error. More information can be found at [Ory Kratos User User Facing Error Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-facing-errors). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetFlowErrorRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetFlowErrorRequest */ -func (a *FrontendApiService) GetFlowError(ctx context.Context) FrontendApiApiGetFlowErrorRequest { - return FrontendApiApiGetFlowErrorRequest{ +func (a *FrontendApiService) GetFlowError(ctx context.Context) FrontendApiGetFlowErrorRequest { + return FrontendApiGetFlowErrorRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return FlowError - */ -func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorRequest) (*FlowError, *http.Response, error) { +// Execute executes the request +// +// @return FlowError +func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiGetFlowErrorRequest) (*FlowError, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *FlowError + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FlowError ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetFlowError") @@ -3133,7 +3185,7 @@ func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorReq return localVarReturnValue, nil, reportError("id is required and must be specified") } - localVarQueryParams.Add("id", parameterToString(*r.id, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "id", r.id, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -3151,7 +3203,7 @@ func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorReq if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3180,6 +3232,7 @@ func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3190,6 +3243,7 @@ func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3200,6 +3254,7 @@ func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr @@ -3217,29 +3272,33 @@ func (a *FrontendApiService) GetFlowErrorExecute(r FrontendApiApiGetFlowErrorReq return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetLoginFlowRequest struct { +type FrontendApiGetLoginFlowRequest struct { ctx context.Context ApiService FrontendApi id *string cookie *string } -func (r FrontendApiApiGetLoginFlowRequest) Id(id string) FrontendApiApiGetLoginFlowRequest { +// The Login Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/login?flow=abcde`). +func (r FrontendApiGetLoginFlowRequest) Id(id string) FrontendApiGetLoginFlowRequest { r.id = &id return r } -func (r FrontendApiApiGetLoginFlowRequest) Cookie(cookie string) FrontendApiApiGetLoginFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiGetLoginFlowRequest) Cookie(cookie string) FrontendApiGetLoginFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiGetLoginFlowRequest) Execute() (*LoginFlow, *http.Response, error) { +func (r FrontendApiGetLoginFlowRequest) Execute() (*LoginFlow, *http.Response, error) { return r.ApiService.GetLoginFlowExecute(r) } /* - - GetLoginFlow Get Login Flow - - This endpoint returns a login flow's context with, for example, error details and other information. +GetLoginFlow Get Login Flow + +This endpoint returns a login flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -3262,28 +3321,26 @@ This request may fail due to several reasons. The `error.id` can be one of: `self_service_flow_expired`: The flow is expired and you should request a new one. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetLoginFlowRequest */ -func (a *FrontendApiService) GetLoginFlow(ctx context.Context) FrontendApiApiGetLoginFlowRequest { - return FrontendApiApiGetLoginFlowRequest{ +func (a *FrontendApiService) GetLoginFlow(ctx context.Context) FrontendApiGetLoginFlowRequest { + return FrontendApiGetLoginFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return LoginFlow - */ -func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowRequest) (*LoginFlow, *http.Response, error) { +// Execute executes the request +// +// @return LoginFlow +func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiGetLoginFlowRequest) (*LoginFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *LoginFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LoginFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetLoginFlow") @@ -3300,7 +3357,7 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq return localVarReturnValue, nil, reportError("id is required and must be specified") } - localVarQueryParams.Add("id", parameterToString(*r.id, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "id", r.id, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -3319,9 +3376,9 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3350,6 +3407,7 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3360,6 +3418,7 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3370,6 +3429,7 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3379,6 +3439,7 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3395,29 +3456,33 @@ func (a *FrontendApiService) GetLoginFlowExecute(r FrontendApiApiGetLoginFlowReq return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetRecoveryFlowRequest struct { +type FrontendApiGetRecoveryFlowRequest struct { ctx context.Context ApiService FrontendApi id *string cookie *string } -func (r FrontendApiApiGetRecoveryFlowRequest) Id(id string) FrontendApiApiGetRecoveryFlowRequest { +// The Flow ID The value for this parameter comes from `request` URL Query parameter sent to your application (e.g. `/recovery?flow=abcde`). +func (r FrontendApiGetRecoveryFlowRequest) Id(id string) FrontendApiGetRecoveryFlowRequest { r.id = &id return r } -func (r FrontendApiApiGetRecoveryFlowRequest) Cookie(cookie string) FrontendApiApiGetRecoveryFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiGetRecoveryFlowRequest) Cookie(cookie string) FrontendApiGetRecoveryFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiGetRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { +func (r FrontendApiGetRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { return r.ApiService.GetRecoveryFlowExecute(r) } /* - - GetRecoveryFlow Get Recovery Flow - - This endpoint returns a recovery flow's context with, for example, error details and other information. +GetRecoveryFlow Get Recovery Flow + +This endpoint returns a recovery flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -3435,28 +3500,26 @@ res.render('recovery', flow) ``` More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetRecoveryFlowRequest */ -func (a *FrontendApiService) GetRecoveryFlow(ctx context.Context) FrontendApiApiGetRecoveryFlowRequest { - return FrontendApiApiGetRecoveryFlowRequest{ +func (a *FrontendApiService) GetRecoveryFlow(ctx context.Context) FrontendApiGetRecoveryFlowRequest { + return FrontendApiGetRecoveryFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RecoveryFlow - */ -func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { +// Execute executes the request +// +// @return RecoveryFlow +func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiGetRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RecoveryFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetRecoveryFlow") @@ -3473,7 +3536,7 @@ func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryF return localVarReturnValue, nil, reportError("id is required and must be specified") } - localVarQueryParams.Add("id", parameterToString(*r.id, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "id", r.id, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -3492,9 +3555,9 @@ func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryF localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3523,6 +3586,7 @@ func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3533,6 +3597,7 @@ func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3542,6 +3607,7 @@ func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3558,29 +3624,33 @@ func (a *FrontendApiService) GetRecoveryFlowExecute(r FrontendApiApiGetRecoveryF return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetRegistrationFlowRequest struct { +type FrontendApiGetRegistrationFlowRequest struct { ctx context.Context ApiService FrontendApi id *string cookie *string } -func (r FrontendApiApiGetRegistrationFlowRequest) Id(id string) FrontendApiApiGetRegistrationFlowRequest { +// The Registration Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/registration?flow=abcde`). +func (r FrontendApiGetRegistrationFlowRequest) Id(id string) FrontendApiGetRegistrationFlowRequest { r.id = &id return r } -func (r FrontendApiApiGetRegistrationFlowRequest) Cookie(cookie string) FrontendApiApiGetRegistrationFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiGetRegistrationFlowRequest) Cookie(cookie string) FrontendApiGetRegistrationFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiGetRegistrationFlowRequest) Execute() (*RegistrationFlow, *http.Response, error) { +func (r FrontendApiGetRegistrationFlowRequest) Execute() (*RegistrationFlow, *http.Response, error) { return r.ApiService.GetRegistrationFlowExecute(r) } /* - - GetRegistrationFlow Get Registration Flow - - This endpoint returns a registration flow's context with, for example, error details and other information. +GetRegistrationFlow Get Registration Flow + +This endpoint returns a registration flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -3603,28 +3673,26 @@ This request may fail due to several reasons. The `error.id` can be one of: `self_service_flow_expired`: The flow is expired and you should request a new one. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetRegistrationFlowRequest */ -func (a *FrontendApiService) GetRegistrationFlow(ctx context.Context) FrontendApiApiGetRegistrationFlowRequest { - return FrontendApiApiGetRegistrationFlowRequest{ +func (a *FrontendApiService) GetRegistrationFlow(ctx context.Context) FrontendApiGetRegistrationFlowRequest { + return FrontendApiGetRegistrationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RegistrationFlow - */ -func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) { +// Execute executes the request +// +// @return RegistrationFlow +func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiGetRegistrationFlowRequest) (*RegistrationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RegistrationFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegistrationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetRegistrationFlow") @@ -3641,7 +3709,7 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis return localVarReturnValue, nil, reportError("id is required and must be specified") } - localVarQueryParams.Add("id", parameterToString(*r.id, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "id", r.id, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -3660,9 +3728,9 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3691,6 +3759,7 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3701,6 +3770,7 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3711,6 +3781,7 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3720,6 +3791,7 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3736,7 +3808,7 @@ func (a *FrontendApiService) GetRegistrationFlowExecute(r FrontendApiApiGetRegis return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetSettingsFlowRequest struct { +type FrontendApiGetSettingsFlowRequest struct { ctx context.Context ApiService FrontendApi id *string @@ -3744,27 +3816,32 @@ type FrontendApiApiGetSettingsFlowRequest struct { cookie *string } -func (r FrontendApiApiGetSettingsFlowRequest) Id(id string) FrontendApiApiGetSettingsFlowRequest { +// ID is the Settings Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/settings?flow=abcde`). +func (r FrontendApiGetSettingsFlowRequest) Id(id string) FrontendApiGetSettingsFlowRequest { r.id = &id return r } -func (r FrontendApiApiGetSettingsFlowRequest) XSessionToken(xSessionToken string) FrontendApiApiGetSettingsFlowRequest { + +// The Session Token When using the SDK in an app without a browser, please include the session token here. +func (r FrontendApiGetSettingsFlowRequest) XSessionToken(xSessionToken string) FrontendApiGetSettingsFlowRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiGetSettingsFlowRequest) Cookie(cookie string) FrontendApiApiGetSettingsFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiGetSettingsFlowRequest) Cookie(cookie string) FrontendApiGetSettingsFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiGetSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { +func (r FrontendApiGetSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { return r.ApiService.GetSettingsFlowExecute(r) } /* - - GetSettingsFlow Get Settings Flow - - When accessing this endpoint through Ory Kratos' Public API you must ensure that either the Ory Kratos Session Cookie +GetSettingsFlow Get Settings Flow +When accessing this endpoint through Ory Kratos' Public API you must ensure that either the Ory Kratos Session Cookie or the Ory Kratos Session Token are set. Depending on your configuration this endpoint might return a 403 error if the session has a lower Authenticator @@ -3783,28 +3860,26 @@ case of an error, the `error.id` of the JSON response body can be one of: identity logged in instead. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetSettingsFlowRequest */ -func (a *FrontendApiService) GetSettingsFlow(ctx context.Context) FrontendApiApiGetSettingsFlowRequest { - return FrontendApiApiGetSettingsFlowRequest{ +func (a *FrontendApiService) GetSettingsFlow(ctx context.Context) FrontendApiGetSettingsFlowRequest { + return FrontendApiGetSettingsFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SettingsFlow - */ -func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { +// Execute executes the request +// +// @return SettingsFlow +func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiGetSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SettingsFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SettingsFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetSettingsFlow") @@ -3821,7 +3896,7 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF return localVarReturnValue, nil, reportError("id is required and must be specified") } - localVarQueryParams.Add("id", parameterToString(*r.id, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "id", r.id, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -3840,12 +3915,12 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3874,6 +3949,7 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3884,6 +3960,7 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3894,6 +3971,7 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3904,6 +3982,7 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3913,6 +3992,7 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3929,29 +4009,33 @@ func (a *FrontendApiService) GetSettingsFlowExecute(r FrontendApiApiGetSettingsF return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetVerificationFlowRequest struct { +type FrontendApiGetVerificationFlowRequest struct { ctx context.Context ApiService FrontendApi id *string cookie *string } -func (r FrontendApiApiGetVerificationFlowRequest) Id(id string) FrontendApiApiGetVerificationFlowRequest { +// The Flow ID The value for this parameter comes from `request` URL Query parameter sent to your application (e.g. `/verification?flow=abcde`). +func (r FrontendApiGetVerificationFlowRequest) Id(id string) FrontendApiGetVerificationFlowRequest { r.id = &id return r } -func (r FrontendApiApiGetVerificationFlowRequest) Cookie(cookie string) FrontendApiApiGetVerificationFlowRequest { + +// HTTP Cookies When using the SDK on the server side you must include the HTTP Cookie Header originally sent to your HTTP handler here. +func (r FrontendApiGetVerificationFlowRequest) Cookie(cookie string) FrontendApiGetVerificationFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiGetVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { +func (r FrontendApiGetVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { return r.ApiService.GetVerificationFlowExecute(r) } /* - - GetVerificationFlow Get Verification Flow - - This endpoint returns a verification flow's context with, for example, error details and other information. +GetVerificationFlow Get Verification Flow + +This endpoint returns a verification flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. @@ -3969,28 +4053,26 @@ res.render('verification', flow) ``` More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetVerificationFlowRequest */ -func (a *FrontendApiService) GetVerificationFlow(ctx context.Context) FrontendApiApiGetVerificationFlowRequest { - return FrontendApiApiGetVerificationFlowRequest{ +func (a *FrontendApiService) GetVerificationFlow(ctx context.Context) FrontendApiGetVerificationFlowRequest { + return FrontendApiGetVerificationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return VerificationFlow - */ -func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { +// Execute executes the request +// +// @return VerificationFlow +func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiGetVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *VerificationFlow + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VerificationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetVerificationFlow") @@ -4007,7 +4089,7 @@ func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerif return localVarReturnValue, nil, reportError("id is required and must be specified") } - localVarQueryParams.Add("id", parameterToString(*r.id, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "id", r.id, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -4026,9 +4108,9 @@ func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerif localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -4057,6 +4139,7 @@ func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerif newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4067,6 +4150,7 @@ func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerif newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4076,6 +4160,7 @@ func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerif newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4092,18 +4177,19 @@ func (a *FrontendApiService) GetVerificationFlowExecute(r FrontendApiApiGetVerif return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiGetWebAuthnJavaScriptRequest struct { +type FrontendApiGetWebAuthnJavaScriptRequest struct { ctx context.Context ApiService FrontendApi } -func (r FrontendApiApiGetWebAuthnJavaScriptRequest) Execute() (string, *http.Response, error) { +func (r FrontendApiGetWebAuthnJavaScriptRequest) Execute() (string, *http.Response, error) { return r.ApiService.GetWebAuthnJavaScriptExecute(r) } /* - - GetWebAuthnJavaScript Get WebAuthn JavaScript - - This endpoint provides JavaScript which is needed in order to perform WebAuthn login and registration. +GetWebAuthnJavaScript Get WebAuthn JavaScript + +This endpoint provides JavaScript which is needed in order to perform WebAuthn login and registration. If you are building a JavaScript Browser App (e.g. in ReactJS or AngularJS) you will need to load this file: @@ -4112,28 +4198,26 @@ If you are building a JavaScript Browser App (e.g. in ReactJS or AngularJS) you ``` More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiGetWebAuthnJavaScriptRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiGetWebAuthnJavaScriptRequest */ -func (a *FrontendApiService) GetWebAuthnJavaScript(ctx context.Context) FrontendApiApiGetWebAuthnJavaScriptRequest { - return FrontendApiApiGetWebAuthnJavaScriptRequest{ +func (a *FrontendApiService) GetWebAuthnJavaScript(ctx context.Context) FrontendApiGetWebAuthnJavaScriptRequest { + return FrontendApiGetWebAuthnJavaScriptRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return string - */ -func (a *FrontendApiService) GetWebAuthnJavaScriptExecute(r FrontendApiApiGetWebAuthnJavaScriptRequest) (string, *http.Response, error) { +// Execute executes the request +// +// @return string +func (a *FrontendApiService) GetWebAuthnJavaScriptExecute(r FrontendApiGetWebAuthnJavaScriptRequest) (string, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue string + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.GetWebAuthnJavaScript") @@ -4164,7 +4248,7 @@ func (a *FrontendApiService) GetWebAuthnJavaScriptExecute(r FrontendApiApiGetWeb if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -4201,7 +4285,7 @@ func (a *FrontendApiService) GetWebAuthnJavaScriptExecute(r FrontendApiApiGetWeb return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiListMySessionsRequest struct { +type FrontendApiListMySessionsRequest struct { ctx context.Context ApiService FrontendApi perPage *int64 @@ -4212,62 +4296,71 @@ type FrontendApiApiListMySessionsRequest struct { cookie *string } -func (r FrontendApiApiListMySessionsRequest) PerPage(perPage int64) FrontendApiApiListMySessionsRequest { +// Deprecated Items per Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This is the number of items per page. +func (r FrontendApiListMySessionsRequest) PerPage(perPage int64) FrontendApiListMySessionsRequest { r.perPage = &perPage return r } -func (r FrontendApiApiListMySessionsRequest) Page(page int64) FrontendApiApiListMySessionsRequest { + +// Deprecated Pagination Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the `Link` header. +func (r FrontendApiListMySessionsRequest) Page(page int64) FrontendApiListMySessionsRequest { r.page = &page return r } -func (r FrontendApiApiListMySessionsRequest) PageSize(pageSize int64) FrontendApiApiListMySessionsRequest { + +// Page Size This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r FrontendApiListMySessionsRequest) PageSize(pageSize int64) FrontendApiListMySessionsRequest { r.pageSize = &pageSize return r } -func (r FrontendApiApiListMySessionsRequest) PageToken(pageToken string) FrontendApiApiListMySessionsRequest { + +// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r FrontendApiListMySessionsRequest) PageToken(pageToken string) FrontendApiListMySessionsRequest { r.pageToken = &pageToken return r } -func (r FrontendApiApiListMySessionsRequest) XSessionToken(xSessionToken string) FrontendApiApiListMySessionsRequest { + +// Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. +func (r FrontendApiListMySessionsRequest) XSessionToken(xSessionToken string) FrontendApiListMySessionsRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiListMySessionsRequest) Cookie(cookie string) FrontendApiApiListMySessionsRequest { + +// Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. +func (r FrontendApiListMySessionsRequest) Cookie(cookie string) FrontendApiListMySessionsRequest { r.cookie = &cookie return r } -func (r FrontendApiApiListMySessionsRequest) Execute() ([]Session, *http.Response, error) { +func (r FrontendApiListMySessionsRequest) Execute() ([]Session, *http.Response, error) { return r.ApiService.ListMySessionsExecute(r) } /* - - ListMySessions Get My Active Sessions - - This endpoints returns all other active sessions that belong to the logged-in user. +ListMySessions Get My Active Sessions +This endpoints returns all other active sessions that belong to the logged-in user. The current session can be retrieved by calling the `/sessions/whoami` endpoint. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiListMySessionsRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiListMySessionsRequest */ -func (a *FrontendApiService) ListMySessions(ctx context.Context) FrontendApiApiListMySessionsRequest { - return FrontendApiApiListMySessionsRequest{ +func (a *FrontendApiService) ListMySessions(ctx context.Context) FrontendApiListMySessionsRequest { + return FrontendApiListMySessionsRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return []Session - */ -func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySessionsRequest) ([]Session, *http.Response, error) { +// Execute executes the request +// +// @return []Session +func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiListMySessionsRequest) ([]Session, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []Session + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Session ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.ListMySessions") @@ -4282,16 +4375,25 @@ func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySession localVarFormParams := url.Values{} if r.perPage != nil { - localVarQueryParams.Add("per_page", parameterToString(*r.perPage, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } else { + var defaultValue int64 = 250 + r.perPage = &defaultValue } if r.page != nil { - localVarQueryParams.Add("page", parameterToString(*r.page, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") } if r.pageSize != nil { - localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "") + } else { + var defaultValue int64 = 250 + r.pageSize = &defaultValue } if r.pageToken != nil { - localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "") + } else { + var defaultValue string = "1" + r.pageToken = &defaultValue } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -4311,12 +4413,12 @@ func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySession localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -4345,6 +4447,7 @@ func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySession newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4355,6 +4458,7 @@ func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySession newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4364,6 +4468,7 @@ func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySession newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4380,25 +4485,25 @@ func (a *FrontendApiService) ListMySessionsExecute(r FrontendApiApiListMySession return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiPerformNativeLogoutRequest struct { +type FrontendApiPerformNativeLogoutRequest struct { ctx context.Context ApiService FrontendApi performNativeLogoutBody *PerformNativeLogoutBody } -func (r FrontendApiApiPerformNativeLogoutRequest) PerformNativeLogoutBody(performNativeLogoutBody PerformNativeLogoutBody) FrontendApiApiPerformNativeLogoutRequest { +func (r FrontendApiPerformNativeLogoutRequest) PerformNativeLogoutBody(performNativeLogoutBody PerformNativeLogoutBody) FrontendApiPerformNativeLogoutRequest { r.performNativeLogoutBody = &performNativeLogoutBody return r } -func (r FrontendApiApiPerformNativeLogoutRequest) Execute() (*http.Response, error) { +func (r FrontendApiPerformNativeLogoutRequest) Execute() (*http.Response, error) { return r.ApiService.PerformNativeLogoutExecute(r) } /* - - PerformNativeLogout Perform Logout for Native Apps - - Use this endpoint to log out an identity using an Ory Session Token. If the Ory Session Token was successfully +PerformNativeLogout Perform Logout for Native Apps +Use this endpoint to log out an identity using an Ory Session Token. If the Ory Session Token was successfully revoked, the server returns a 204 No Content response. A 204 No Content response is also sent when the Ory Session Token has been revoked already before. @@ -4406,26 +4511,23 @@ If the Ory Session Token is malformed or does not exist a 403 Forbidden response This endpoint does not remove any HTTP Cookies - use the Browser-Based Self-Service Logout Flow instead. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiPerformNativeLogoutRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiPerformNativeLogoutRequest */ -func (a *FrontendApiService) PerformNativeLogout(ctx context.Context) FrontendApiApiPerformNativeLogoutRequest { - return FrontendApiApiPerformNativeLogoutRequest{ +func (a *FrontendApiService) PerformNativeLogout(ctx context.Context) FrontendApiPerformNativeLogoutRequest { + return FrontendApiPerformNativeLogoutRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - */ -func (a *FrontendApiService) PerformNativeLogoutExecute(r FrontendApiApiPerformNativeLogoutRequest) (*http.Response, error) { +// Execute executes the request +func (a *FrontendApiService) PerformNativeLogoutExecute(r FrontendApiPerformNativeLogoutRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.PerformNativeLogout") @@ -4461,7 +4563,7 @@ func (a *FrontendApiService) PerformNativeLogoutExecute(r FrontendApiApiPerformN } // body params localVarPostBody = r.performNativeLogoutBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -4490,6 +4592,7 @@ func (a *FrontendApiService) PerformNativeLogoutExecute(r FrontendApiApiPerformN newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -4499,6 +4602,7 @@ func (a *FrontendApiService) PerformNativeLogoutExecute(r FrontendApiApiPerformN newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -4506,7 +4610,7 @@ func (a *FrontendApiService) PerformNativeLogoutExecute(r FrontendApiApiPerformN return localVarHTTPResponse, nil } -type FrontendApiApiToSessionRequest struct { +type FrontendApiToSessionRequest struct { ctx context.Context ApiService FrontendApi xSessionToken *string @@ -4514,27 +4618,32 @@ type FrontendApiApiToSessionRequest struct { tokenizeAs *string } -func (r FrontendApiApiToSessionRequest) XSessionToken(xSessionToken string) FrontendApiApiToSessionRequest { +// Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. +func (r FrontendApiToSessionRequest) XSessionToken(xSessionToken string) FrontendApiToSessionRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiToSessionRequest) Cookie(cookie string) FrontendApiApiToSessionRequest { + +// Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. +func (r FrontendApiToSessionRequest) Cookie(cookie string) FrontendApiToSessionRequest { r.cookie = &cookie return r } -func (r FrontendApiApiToSessionRequest) TokenizeAs(tokenizeAs string) FrontendApiApiToSessionRequest { + +// Returns the session additionally as a token (such as a JWT) The value of this parameter has to be a valid, configured Ory Session token template. For more information head over to [the documentation](http://ory.sh/docs/identities/session-to-jwt-cors). +func (r FrontendApiToSessionRequest) TokenizeAs(tokenizeAs string) FrontendApiToSessionRequest { r.tokenizeAs = &tokenizeAs return r } -func (r FrontendApiApiToSessionRequest) Execute() (*Session, *http.Response, error) { +func (r FrontendApiToSessionRequest) Execute() (*Session, *http.Response, error) { return r.ApiService.ToSessionExecute(r) } /* - - ToSession Check Who the Current HTTP Session Belongs To - - Uses the HTTP Headers in the GET request to determine (e.g. by using checking the cookies) who is authenticated. +ToSession Check Who the Current HTTP Session Belongs To +Uses the HTTP Headers in the GET request to determine (e.g. by using checking the cookies) who is authenticated. Returns a session object in the body or 401 if the credentials are invalid or no credentials were sent. When the request it successful it adds the user ID to the 'X-Kratos-Authenticated-Identity-Id' header in the response. @@ -4593,28 +4702,26 @@ As explained above, this request may fail due to several reasons. The `error.id` `session_inactive`: No active session was found in the request (e.g. no Ory Session Cookie / Ory Session Token). `session_aal2_required`: An active session was found but it does not fulfil the Authenticator Assurance Level, implying that the session must (e.g.) authenticate the second factor. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiToSessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiToSessionRequest */ -func (a *FrontendApiService) ToSession(ctx context.Context) FrontendApiApiToSessionRequest { - return FrontendApiApiToSessionRequest{ +func (a *FrontendApiService) ToSession(ctx context.Context) FrontendApiToSessionRequest { + return FrontendApiToSessionRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return Session - */ -func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) (*Session, *http.Response, error) { +// Execute executes the request +// +// @return Session +func (a *FrontendApiService) ToSessionExecute(r FrontendApiToSessionRequest) (*Session, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Session + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Session ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.ToSession") @@ -4629,7 +4736,7 @@ func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) localVarFormParams := url.Values{} if r.tokenizeAs != nil { - localVarQueryParams.Add("tokenize_as", parameterToString(*r.tokenizeAs, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "tokenize_as", r.tokenizeAs, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -4649,12 +4756,12 @@ func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -4683,6 +4790,7 @@ func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4693,6 +4801,7 @@ func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4702,6 +4811,7 @@ func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4718,7 +4828,7 @@ func (a *FrontendApiService) ToSessionExecute(r FrontendApiApiToSessionRequest) return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiUpdateLoginFlowRequest struct { +type FrontendApiUpdateLoginFlowRequest struct { ctx context.Context ApiService FrontendApi flow *string @@ -4727,31 +4837,37 @@ type FrontendApiApiUpdateLoginFlowRequest struct { cookie *string } -func (r FrontendApiApiUpdateLoginFlowRequest) Flow(flow string) FrontendApiApiUpdateLoginFlowRequest { +// The Login Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/login?flow=abcde`). +func (r FrontendApiUpdateLoginFlowRequest) Flow(flow string) FrontendApiUpdateLoginFlowRequest { r.flow = &flow return r } -func (r FrontendApiApiUpdateLoginFlowRequest) UpdateLoginFlowBody(updateLoginFlowBody UpdateLoginFlowBody) FrontendApiApiUpdateLoginFlowRequest { + +func (r FrontendApiUpdateLoginFlowRequest) UpdateLoginFlowBody(updateLoginFlowBody UpdateLoginFlowBody) FrontendApiUpdateLoginFlowRequest { r.updateLoginFlowBody = &updateLoginFlowBody return r } -func (r FrontendApiApiUpdateLoginFlowRequest) XSessionToken(xSessionToken string) FrontendApiApiUpdateLoginFlowRequest { + +// The Session Token of the Identity performing the settings flow. +func (r FrontendApiUpdateLoginFlowRequest) XSessionToken(xSessionToken string) FrontendApiUpdateLoginFlowRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiUpdateLoginFlowRequest) Cookie(cookie string) FrontendApiApiUpdateLoginFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiUpdateLoginFlowRequest) Cookie(cookie string) FrontendApiUpdateLoginFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiUpdateLoginFlowRequest) Execute() (*SuccessfulNativeLogin, *http.Response, error) { +func (r FrontendApiUpdateLoginFlowRequest) Execute() (*SuccessfulNativeLogin, *http.Response, error) { return r.ApiService.UpdateLoginFlowExecute(r) } /* - - UpdateLoginFlow Submit a Login Flow - - Use this endpoint to complete a login flow. This endpoint +UpdateLoginFlow Submit a Login Flow +Use this endpoint to complete a login flow. This endpoint behaves differently for API and browser flows. API flows expect `application/json` to be sent in the body and responds with @@ -4778,28 +4894,26 @@ case of an error, the `error.id` of the JSON response body can be one of: Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiUpdateLoginFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateLoginFlowRequest */ -func (a *FrontendApiService) UpdateLoginFlow(ctx context.Context) FrontendApiApiUpdateLoginFlowRequest { - return FrontendApiApiUpdateLoginFlowRequest{ +func (a *FrontendApiService) UpdateLoginFlow(ctx context.Context) FrontendApiUpdateLoginFlowRequest { + return FrontendApiUpdateLoginFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SuccessfulNativeLogin - */ -func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginFlowRequest) (*SuccessfulNativeLogin, *http.Response, error) { +// Execute executes the request +// +// @return SuccessfulNativeLogin +func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiUpdateLoginFlowRequest) (*SuccessfulNativeLogin, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SuccessfulNativeLogin + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SuccessfulNativeLogin ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.UpdateLoginFlow") @@ -4819,7 +4933,7 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF return localVarReturnValue, nil, reportError("updateLoginFlowBody is required and must be specified") } - localVarQueryParams.Add("flow", parameterToString(*r.flow, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "flow", r.flow, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} @@ -4838,14 +4952,14 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } // body params localVarPostBody = r.updateLoginFlowBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -4874,6 +4988,7 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4884,6 +4999,7 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4894,6 +5010,7 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4903,6 +5020,7 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -4919,7 +5037,7 @@ func (a *FrontendApiService) UpdateLoginFlowExecute(r FrontendApiApiUpdateLoginF return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiUpdateLogoutFlowRequest struct { +type FrontendApiUpdateLogoutFlowRequest struct { ctx context.Context ApiService FrontendApi token *string @@ -4927,26 +5045,32 @@ type FrontendApiApiUpdateLogoutFlowRequest struct { cookie *string } -func (r FrontendApiApiUpdateLogoutFlowRequest) Token(token string) FrontendApiApiUpdateLogoutFlowRequest { +// A Valid Logout Token If you do not have a logout token because you only have a session cookie, call `/self-service/logout/browser` to generate a URL for this endpoint. +func (r FrontendApiUpdateLogoutFlowRequest) Token(token string) FrontendApiUpdateLogoutFlowRequest { r.token = &token return r } -func (r FrontendApiApiUpdateLogoutFlowRequest) ReturnTo(returnTo string) FrontendApiApiUpdateLogoutFlowRequest { + +// The URL to return to after the logout was completed. +func (r FrontendApiUpdateLogoutFlowRequest) ReturnTo(returnTo string) FrontendApiUpdateLogoutFlowRequest { r.returnTo = &returnTo return r } -func (r FrontendApiApiUpdateLogoutFlowRequest) Cookie(cookie string) FrontendApiApiUpdateLogoutFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiUpdateLogoutFlowRequest) Cookie(cookie string) FrontendApiUpdateLogoutFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiUpdateLogoutFlowRequest) Execute() (*http.Response, error) { +func (r FrontendApiUpdateLogoutFlowRequest) Execute() (*http.Response, error) { return r.ApiService.UpdateLogoutFlowExecute(r) } /* - - UpdateLogoutFlow Update Logout Flow - - This endpoint logs out an identity in a self-service manner. +UpdateLogoutFlow Update Logout Flow + +This endpoint logs out an identity in a self-service manner. If the `Accept` HTTP header is not set to `application/json`, the browser will be redirected (HTTP 303 See Other) to the `return_to` parameter of the initial request or fall back to `urls.default_return_to`. @@ -4959,26 +5083,23 @@ with browsers (Chrome, Firefox, ...). For API clients you can call the `/self-service/logout/api` URL directly with the Ory Session Token. More information can be found at [Ory Kratos User Logout Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-logout). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiUpdateLogoutFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateLogoutFlowRequest */ -func (a *FrontendApiService) UpdateLogoutFlow(ctx context.Context) FrontendApiApiUpdateLogoutFlowRequest { - return FrontendApiApiUpdateLogoutFlowRequest{ +func (a *FrontendApiService) UpdateLogoutFlow(ctx context.Context) FrontendApiUpdateLogoutFlowRequest { + return FrontendApiUpdateLogoutFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - */ -func (a *FrontendApiService) UpdateLogoutFlowExecute(r FrontendApiApiUpdateLogoutFlowRequest) (*http.Response, error) { +// Execute executes the request +func (a *FrontendApiService) UpdateLogoutFlowExecute(r FrontendApiUpdateLogoutFlowRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.UpdateLogoutFlow") @@ -4993,10 +5114,10 @@ func (a *FrontendApiService) UpdateLogoutFlowExecute(r FrontendApiApiUpdateLogou localVarFormParams := url.Values{} if r.token != nil { - localVarQueryParams.Add("token", parameterToString(*r.token, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "token", r.token, "") } if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -5016,9 +5137,9 @@ func (a *FrontendApiService) UpdateLogoutFlowExecute(r FrontendApiApiUpdateLogou localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -5046,6 +5167,7 @@ func (a *FrontendApiService) UpdateLogoutFlowExecute(r FrontendApiApiUpdateLogou newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -5053,7 +5175,7 @@ func (a *FrontendApiService) UpdateLogoutFlowExecute(r FrontendApiApiUpdateLogou return localVarHTTPResponse, nil } -type FrontendApiApiUpdateRecoveryFlowRequest struct { +type FrontendApiUpdateRecoveryFlowRequest struct { ctx context.Context ApiService FrontendApi flow *string @@ -5062,31 +5184,37 @@ type FrontendApiApiUpdateRecoveryFlowRequest struct { cookie *string } -func (r FrontendApiApiUpdateRecoveryFlowRequest) Flow(flow string) FrontendApiApiUpdateRecoveryFlowRequest { +// The Recovery Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/recovery?flow=abcde`). +func (r FrontendApiUpdateRecoveryFlowRequest) Flow(flow string) FrontendApiUpdateRecoveryFlowRequest { r.flow = &flow return r } -func (r FrontendApiApiUpdateRecoveryFlowRequest) UpdateRecoveryFlowBody(updateRecoveryFlowBody UpdateRecoveryFlowBody) FrontendApiApiUpdateRecoveryFlowRequest { + +func (r FrontendApiUpdateRecoveryFlowRequest) UpdateRecoveryFlowBody(updateRecoveryFlowBody UpdateRecoveryFlowBody) FrontendApiUpdateRecoveryFlowRequest { r.updateRecoveryFlowBody = &updateRecoveryFlowBody return r } -func (r FrontendApiApiUpdateRecoveryFlowRequest) Token(token string) FrontendApiApiUpdateRecoveryFlowRequest { + +// Recovery Token The recovery token which completes the recovery request. If the token is invalid (e.g. expired) an error will be shown to the end-user. This parameter is usually set in a link and not used by any direct API call. +func (r FrontendApiUpdateRecoveryFlowRequest) Token(token string) FrontendApiUpdateRecoveryFlowRequest { r.token = &token return r } -func (r FrontendApiApiUpdateRecoveryFlowRequest) Cookie(cookie string) FrontendApiApiUpdateRecoveryFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiUpdateRecoveryFlowRequest) Cookie(cookie string) FrontendApiUpdateRecoveryFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiUpdateRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { +func (r FrontendApiUpdateRecoveryFlowRequest) Execute() (*RecoveryFlow, *http.Response, error) { return r.ApiService.UpdateRecoveryFlowExecute(r) } /* - - UpdateRecoveryFlow Update Recovery Flow - - Use this endpoint to update a recovery flow. This endpoint +UpdateRecoveryFlow Update Recovery Flow +Use this endpoint to update a recovery flow. This endpoint behaves differently for API and browser flows and has several states: `choose_method` expects `flow` (in the URL query) and `email` (in the body) to be sent @@ -5102,28 +5230,26 @@ does not have any API capabilities. The server responds with a HTTP 303 See Othe a new Recovery Flow ID which contains an error message that the recovery link was invalid. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiUpdateRecoveryFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateRecoveryFlowRequest */ -func (a *FrontendApiService) UpdateRecoveryFlow(ctx context.Context) FrontendApiApiUpdateRecoveryFlowRequest { - return FrontendApiApiUpdateRecoveryFlowRequest{ +func (a *FrontendApiService) UpdateRecoveryFlow(ctx context.Context) FrontendApiUpdateRecoveryFlowRequest { + return FrontendApiUpdateRecoveryFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RecoveryFlow - */ -func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { +// Execute executes the request +// +// @return RecoveryFlow +func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiUpdateRecoveryFlowRequest) (*RecoveryFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RecoveryFlow + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.UpdateRecoveryFlow") @@ -5143,9 +5269,9 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec return localVarReturnValue, nil, reportError("updateRecoveryFlowBody is required and must be specified") } - localVarQueryParams.Add("flow", parameterToString(*r.flow, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "flow", r.flow, "") if r.token != nil { - localVarQueryParams.Add("token", parameterToString(*r.token, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "token", r.token, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} @@ -5165,11 +5291,11 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } // body params localVarPostBody = r.updateRecoveryFlowBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -5198,6 +5324,7 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5208,6 +5335,7 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5218,6 +5346,7 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5227,6 +5356,7 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5243,7 +5373,7 @@ func (a *FrontendApiService) UpdateRecoveryFlowExecute(r FrontendApiApiUpdateRec return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiUpdateRegistrationFlowRequest struct { +type FrontendApiUpdateRegistrationFlowRequest struct { ctx context.Context ApiService FrontendApi flow *string @@ -5251,27 +5381,31 @@ type FrontendApiApiUpdateRegistrationFlowRequest struct { cookie *string } -func (r FrontendApiApiUpdateRegistrationFlowRequest) Flow(flow string) FrontendApiApiUpdateRegistrationFlowRequest { +// The Registration Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/registration?flow=abcde`). +func (r FrontendApiUpdateRegistrationFlowRequest) Flow(flow string) FrontendApiUpdateRegistrationFlowRequest { r.flow = &flow return r } -func (r FrontendApiApiUpdateRegistrationFlowRequest) UpdateRegistrationFlowBody(updateRegistrationFlowBody UpdateRegistrationFlowBody) FrontendApiApiUpdateRegistrationFlowRequest { + +func (r FrontendApiUpdateRegistrationFlowRequest) UpdateRegistrationFlowBody(updateRegistrationFlowBody UpdateRegistrationFlowBody) FrontendApiUpdateRegistrationFlowRequest { r.updateRegistrationFlowBody = &updateRegistrationFlowBody return r } -func (r FrontendApiApiUpdateRegistrationFlowRequest) Cookie(cookie string) FrontendApiApiUpdateRegistrationFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiUpdateRegistrationFlowRequest) Cookie(cookie string) FrontendApiUpdateRegistrationFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiUpdateRegistrationFlowRequest) Execute() (*SuccessfulNativeRegistration, *http.Response, error) { +func (r FrontendApiUpdateRegistrationFlowRequest) Execute() (*SuccessfulNativeRegistration, *http.Response, error) { return r.ApiService.UpdateRegistrationFlowExecute(r) } /* - - UpdateRegistrationFlow Update Registration Flow - - Use this endpoint to complete a registration flow by sending an identity's traits and password. This endpoint +UpdateRegistrationFlow Update Registration Flow +Use this endpoint to complete a registration flow by sending an identity's traits and password. This endpoint behaves differently for API and browser flows. API flows expect `application/json` to be sent in the body and respond with @@ -5299,28 +5433,26 @@ case of an error, the `error.id` of the JSON response body can be one of: Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiUpdateRegistrationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateRegistrationFlowRequest */ -func (a *FrontendApiService) UpdateRegistrationFlow(ctx context.Context) FrontendApiApiUpdateRegistrationFlowRequest { - return FrontendApiApiUpdateRegistrationFlowRequest{ +func (a *FrontendApiService) UpdateRegistrationFlow(ctx context.Context) FrontendApiUpdateRegistrationFlowRequest { + return FrontendApiUpdateRegistrationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SuccessfulNativeRegistration - */ -func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdateRegistrationFlowRequest) (*SuccessfulNativeRegistration, *http.Response, error) { +// Execute executes the request +// +// @return SuccessfulNativeRegistration +func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiUpdateRegistrationFlowRequest) (*SuccessfulNativeRegistration, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SuccessfulNativeRegistration + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SuccessfulNativeRegistration ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.UpdateRegistrationFlow") @@ -5340,7 +5472,7 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat return localVarReturnValue, nil, reportError("updateRegistrationFlowBody is required and must be specified") } - localVarQueryParams.Add("flow", parameterToString(*r.flow, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "flow", r.flow, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} @@ -5359,11 +5491,11 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } // body params localVarPostBody = r.updateRegistrationFlowBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -5392,6 +5524,7 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5402,6 +5535,7 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5412,6 +5546,7 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5421,6 +5556,7 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5437,7 +5573,7 @@ func (a *FrontendApiService) UpdateRegistrationFlowExecute(r FrontendApiApiUpdat return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiUpdateSettingsFlowRequest struct { +type FrontendApiUpdateSettingsFlowRequest struct { ctx context.Context ApiService FrontendApi flow *string @@ -5446,31 +5582,37 @@ type FrontendApiApiUpdateSettingsFlowRequest struct { cookie *string } -func (r FrontendApiApiUpdateSettingsFlowRequest) Flow(flow string) FrontendApiApiUpdateSettingsFlowRequest { +// The Settings Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/settings?flow=abcde`). +func (r FrontendApiUpdateSettingsFlowRequest) Flow(flow string) FrontendApiUpdateSettingsFlowRequest { r.flow = &flow return r } -func (r FrontendApiApiUpdateSettingsFlowRequest) UpdateSettingsFlowBody(updateSettingsFlowBody UpdateSettingsFlowBody) FrontendApiApiUpdateSettingsFlowRequest { + +func (r FrontendApiUpdateSettingsFlowRequest) UpdateSettingsFlowBody(updateSettingsFlowBody UpdateSettingsFlowBody) FrontendApiUpdateSettingsFlowRequest { r.updateSettingsFlowBody = &updateSettingsFlowBody return r } -func (r FrontendApiApiUpdateSettingsFlowRequest) XSessionToken(xSessionToken string) FrontendApiApiUpdateSettingsFlowRequest { + +// The Session Token of the Identity performing the settings flow. +func (r FrontendApiUpdateSettingsFlowRequest) XSessionToken(xSessionToken string) FrontendApiUpdateSettingsFlowRequest { r.xSessionToken = &xSessionToken return r } -func (r FrontendApiApiUpdateSettingsFlowRequest) Cookie(cookie string) FrontendApiApiUpdateSettingsFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiUpdateSettingsFlowRequest) Cookie(cookie string) FrontendApiUpdateSettingsFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiUpdateSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { +func (r FrontendApiUpdateSettingsFlowRequest) Execute() (*SettingsFlow, *http.Response, error) { return r.ApiService.UpdateSettingsFlowExecute(r) } /* - - UpdateSettingsFlow Complete Settings Flow - - Use this endpoint to complete a settings flow by sending an identity's updated password. This endpoint +UpdateSettingsFlow Complete Settings Flow +Use this endpoint to complete a settings flow by sending an identity's updated password. This endpoint behaves differently for API and browser flows. API-initiated flows expect `application/json` to be sent in the body and respond with @@ -5513,28 +5655,26 @@ identity logged in instead. Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiUpdateSettingsFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateSettingsFlowRequest */ -func (a *FrontendApiService) UpdateSettingsFlow(ctx context.Context) FrontendApiApiUpdateSettingsFlowRequest { - return FrontendApiApiUpdateSettingsFlowRequest{ +func (a *FrontendApiService) UpdateSettingsFlow(ctx context.Context) FrontendApiUpdateSettingsFlowRequest { + return FrontendApiUpdateSettingsFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return SettingsFlow - */ -func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { +// Execute executes the request +// +// @return SettingsFlow +func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiUpdateSettingsFlowRequest) (*SettingsFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *SettingsFlow + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SettingsFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.UpdateSettingsFlow") @@ -5554,7 +5694,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet return localVarReturnValue, nil, reportError("updateSettingsFlowBody is required and must be specified") } - localVarQueryParams.Add("flow", parameterToString(*r.flow, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "flow", r.flow, "") // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} @@ -5573,14 +5713,14 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xSessionToken != nil { - localVarHeaderParams["X-Session-Token"] = parameterToString(*r.xSessionToken, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Session-Token", r.xSessionToken, "") } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } // body params localVarPostBody = r.updateSettingsFlowBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -5609,6 +5749,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5619,6 +5760,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5629,6 +5771,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5639,6 +5782,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5649,6 +5793,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5658,6 +5803,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5674,7 +5820,7 @@ func (a *FrontendApiService) UpdateSettingsFlowExecute(r FrontendApiApiUpdateSet return localVarReturnValue, localVarHTTPResponse, nil } -type FrontendApiApiUpdateVerificationFlowRequest struct { +type FrontendApiUpdateVerificationFlowRequest struct { ctx context.Context ApiService FrontendApi flow *string @@ -5683,31 +5829,37 @@ type FrontendApiApiUpdateVerificationFlowRequest struct { cookie *string } -func (r FrontendApiApiUpdateVerificationFlowRequest) Flow(flow string) FrontendApiApiUpdateVerificationFlowRequest { +// The Verification Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/verification?flow=abcde`). +func (r FrontendApiUpdateVerificationFlowRequest) Flow(flow string) FrontendApiUpdateVerificationFlowRequest { r.flow = &flow return r } -func (r FrontendApiApiUpdateVerificationFlowRequest) UpdateVerificationFlowBody(updateVerificationFlowBody UpdateVerificationFlowBody) FrontendApiApiUpdateVerificationFlowRequest { + +func (r FrontendApiUpdateVerificationFlowRequest) UpdateVerificationFlowBody(updateVerificationFlowBody UpdateVerificationFlowBody) FrontendApiUpdateVerificationFlowRequest { r.updateVerificationFlowBody = &updateVerificationFlowBody return r } -func (r FrontendApiApiUpdateVerificationFlowRequest) Token(token string) FrontendApiApiUpdateVerificationFlowRequest { + +// Verification Token The verification token which completes the verification request. If the token is invalid (e.g. expired) an error will be shown to the end-user. This parameter is usually set in a link and not used by any direct API call. +func (r FrontendApiUpdateVerificationFlowRequest) Token(token string) FrontendApiUpdateVerificationFlowRequest { r.token = &token return r } -func (r FrontendApiApiUpdateVerificationFlowRequest) Cookie(cookie string) FrontendApiApiUpdateVerificationFlowRequest { + +// HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. +func (r FrontendApiUpdateVerificationFlowRequest) Cookie(cookie string) FrontendApiUpdateVerificationFlowRequest { r.cookie = &cookie return r } -func (r FrontendApiApiUpdateVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { +func (r FrontendApiUpdateVerificationFlowRequest) Execute() (*VerificationFlow, *http.Response, error) { return r.ApiService.UpdateVerificationFlowExecute(r) } /* - - UpdateVerificationFlow Complete Verification Flow - - Use this endpoint to complete a verification flow. This endpoint +UpdateVerificationFlow Complete Verification Flow +Use this endpoint to complete a verification flow. This endpoint behaves differently for API and browser flows and has several states: `choose_method` expects `flow` (in the URL query) and `email` (in the body) to be sent @@ -5723,28 +5875,26 @@ does not have any API capabilities. The server responds with a HTTP 303 See Othe a new Verification Flow ID which contains an error message that the verification link was invalid. More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return FrontendApiApiUpdateVerificationFlowRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FrontendApiUpdateVerificationFlowRequest */ -func (a *FrontendApiService) UpdateVerificationFlow(ctx context.Context) FrontendApiApiUpdateVerificationFlowRequest { - return FrontendApiApiUpdateVerificationFlowRequest{ +func (a *FrontendApiService) UpdateVerificationFlow(ctx context.Context) FrontendApiUpdateVerificationFlowRequest { + return FrontendApiUpdateVerificationFlowRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return VerificationFlow - */ -func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiApiUpdateVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { +// Execute executes the request +// +// @return VerificationFlow +func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiUpdateVerificationFlowRequest) (*VerificationFlow, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *VerificationFlow + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VerificationFlow ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FrontendApiService.UpdateVerificationFlow") @@ -5764,9 +5914,9 @@ func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiApiUpdat return localVarReturnValue, nil, reportError("updateVerificationFlowBody is required and must be specified") } - localVarQueryParams.Add("flow", parameterToString(*r.flow, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "flow", r.flow, "") if r.token != nil { - localVarQueryParams.Add("token", parameterToString(*r.token, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "token", r.token, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} @@ -5786,11 +5936,11 @@ func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiApiUpdat localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.cookie != nil { - localVarHeaderParams["Cookie"] = parameterToString(*r.cookie, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "Cookie", r.cookie, "") } // body params localVarPostBody = r.updateVerificationFlowBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -5819,6 +5969,7 @@ func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5829,6 +5980,7 @@ func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -5838,6 +5990,7 @@ func (a *FrontendApiService) UpdateVerificationFlowExecute(r FrontendApiApiUpdat newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/internal/httpclient/api_identity.go b/internal/httpclient/api_identity.go index bc1b675876fb..8718ac8d6b5b 100644 --- a/internal/httpclient/api_identity.go +++ b/internal/httpclient/api_identity.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -21,341 +21,334 @@ import ( "strings" ) -// Linger please -var ( - _ context.Context -) - type IdentityApi interface { /* - * BatchPatchIdentities Create and deletes multiple identities - * Creates or delete multiple + BatchPatchIdentities Create and deletes multiple identities + + Creates or delete multiple [identities](https://www.ory.sh/docs/kratos/concepts/identity-user-model). This endpoint can also be used to [import credentials](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities) for instance passwords, social sign in configurations or multifactor methods. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiBatchPatchIdentitiesRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiBatchPatchIdentitiesRequest */ - BatchPatchIdentities(ctx context.Context) IdentityApiApiBatchPatchIdentitiesRequest + BatchPatchIdentities(ctx context.Context) IdentityApiBatchPatchIdentitiesRequest - /* - * BatchPatchIdentitiesExecute executes the request - * @return BatchPatchIdentitiesResponse - */ - BatchPatchIdentitiesExecute(r IdentityApiApiBatchPatchIdentitiesRequest) (*BatchPatchIdentitiesResponse, *http.Response, error) + // BatchPatchIdentitiesExecute executes the request + // @return BatchPatchIdentitiesResponse + BatchPatchIdentitiesExecute(r IdentityApiBatchPatchIdentitiesRequest) (*BatchPatchIdentitiesResponse, *http.Response, error) /* - * CreateIdentity Create an Identity - * Create an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). This endpoint can also be used to + CreateIdentity Create an Identity + + Create an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). This endpoint can also be used to [import credentials](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities) for instance passwords, social sign in configurations or multifactor methods. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiCreateIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiCreateIdentityRequest */ - CreateIdentity(ctx context.Context) IdentityApiApiCreateIdentityRequest + CreateIdentity(ctx context.Context) IdentityApiCreateIdentityRequest - /* - * CreateIdentityExecute executes the request - * @return Identity - */ - CreateIdentityExecute(r IdentityApiApiCreateIdentityRequest) (*Identity, *http.Response, error) + // CreateIdentityExecute executes the request + // @return Identity + CreateIdentityExecute(r IdentityApiCreateIdentityRequest) (*Identity, *http.Response, error) /* - * CreateRecoveryCodeForIdentity Create a Recovery Code - * This endpoint creates a recovery code which should be given to the user in order for them to recover + CreateRecoveryCodeForIdentity Create a Recovery Code + + This endpoint creates a recovery code which should be given to the user in order for them to recover (or activate) their account. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiCreateRecoveryCodeForIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiCreateRecoveryCodeForIdentityRequest */ - CreateRecoveryCodeForIdentity(ctx context.Context) IdentityApiApiCreateRecoveryCodeForIdentityRequest + CreateRecoveryCodeForIdentity(ctx context.Context) IdentityApiCreateRecoveryCodeForIdentityRequest - /* - * CreateRecoveryCodeForIdentityExecute executes the request - * @return RecoveryCodeForIdentity - */ - CreateRecoveryCodeForIdentityExecute(r IdentityApiApiCreateRecoveryCodeForIdentityRequest) (*RecoveryCodeForIdentity, *http.Response, error) + // CreateRecoveryCodeForIdentityExecute executes the request + // @return RecoveryCodeForIdentity + CreateRecoveryCodeForIdentityExecute(r IdentityApiCreateRecoveryCodeForIdentityRequest) (*RecoveryCodeForIdentity, *http.Response, error) /* - * CreateRecoveryLinkForIdentity Create a Recovery Link - * This endpoint creates a recovery link which should be given to the user in order for them to recover + CreateRecoveryLinkForIdentity Create a Recovery Link + + This endpoint creates a recovery link which should be given to the user in order for them to recover (or activate) their account. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiCreateRecoveryLinkForIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiCreateRecoveryLinkForIdentityRequest */ - CreateRecoveryLinkForIdentity(ctx context.Context) IdentityApiApiCreateRecoveryLinkForIdentityRequest + CreateRecoveryLinkForIdentity(ctx context.Context) IdentityApiCreateRecoveryLinkForIdentityRequest - /* - * CreateRecoveryLinkForIdentityExecute executes the request - * @return RecoveryLinkForIdentity - */ - CreateRecoveryLinkForIdentityExecute(r IdentityApiApiCreateRecoveryLinkForIdentityRequest) (*RecoveryLinkForIdentity, *http.Response, error) + // CreateRecoveryLinkForIdentityExecute executes the request + // @return RecoveryLinkForIdentity + CreateRecoveryLinkForIdentityExecute(r IdentityApiCreateRecoveryLinkForIdentityRequest) (*RecoveryLinkForIdentity, *http.Response, error) /* - * DeleteIdentity Delete an Identity - * Calling this endpoint irrecoverably and permanently deletes the [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) given its ID. This action can not be undone. + DeleteIdentity Delete an Identity + + Calling this endpoint irrecoverably and permanently deletes the [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) given its ID. This action can not be undone. This endpoint returns 204 when the identity was deleted or when the identity was not found, in which case it is assumed that is has been deleted already. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the identity's ID. - * @return IdentityApiApiDeleteIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @return IdentityApiDeleteIdentityRequest */ - DeleteIdentity(ctx context.Context, id string) IdentityApiApiDeleteIdentityRequest + DeleteIdentity(ctx context.Context, id string) IdentityApiDeleteIdentityRequest - /* - * DeleteIdentityExecute executes the request - */ - DeleteIdentityExecute(r IdentityApiApiDeleteIdentityRequest) (*http.Response, error) + // DeleteIdentityExecute executes the request + DeleteIdentityExecute(r IdentityApiDeleteIdentityRequest) (*http.Response, error) /* - * DeleteIdentityCredentials Delete a credential for a specific identity - * Delete an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) credential by its type + DeleteIdentityCredentials Delete a credential for a specific identity + + Delete an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) credential by its type You can only delete second factor (aal2) credentials. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the identity's ID. - * @param type_ Type is the type of credentials to be deleted. password CredentialsTypePassword oidc CredentialsTypeOIDC totp CredentialsTypeTOTP lookup_secret CredentialsTypeLookup webauthn CredentialsTypeWebAuthn code CredentialsTypeCodeAuth link_recovery CredentialsTypeRecoveryLink CredentialsTypeRecoveryLink is a special credential type linked to the link strategy (recovery flow). It is not used within the credentials object itself. code_recovery CredentialsTypeRecoveryCode - * @return IdentityApiApiDeleteIdentityCredentialsRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @param type_ Type is the type of credentials to be deleted. password CredentialsTypePassword oidc CredentialsTypeOIDC totp CredentialsTypeTOTP lookup_secret CredentialsTypeLookup webauthn CredentialsTypeWebAuthn code CredentialsTypeCodeAuth link_recovery CredentialsTypeRecoveryLink CredentialsTypeRecoveryLink is a special credential type linked to the link strategy (recovery flow). It is not used within the credentials object itself. code_recovery CredentialsTypeRecoveryCode + @return IdentityApiDeleteIdentityCredentialsRequest */ - DeleteIdentityCredentials(ctx context.Context, id string, type_ string) IdentityApiApiDeleteIdentityCredentialsRequest + DeleteIdentityCredentials(ctx context.Context, id string, type_ string) IdentityApiDeleteIdentityCredentialsRequest - /* - * DeleteIdentityCredentialsExecute executes the request - */ - DeleteIdentityCredentialsExecute(r IdentityApiApiDeleteIdentityCredentialsRequest) (*http.Response, error) + // DeleteIdentityCredentialsExecute executes the request + DeleteIdentityCredentialsExecute(r IdentityApiDeleteIdentityCredentialsRequest) (*http.Response, error) /* - * DeleteIdentitySessions Delete & Invalidate an Identity's Sessions - * Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the identity's ID. - * @return IdentityApiApiDeleteIdentitySessionsRequest - */ - DeleteIdentitySessions(ctx context.Context, id string) IdentityApiApiDeleteIdentitySessionsRequest + DeleteIdentitySessions Delete & Invalidate an Identity's Sessions - /* - * DeleteIdentitySessionsExecute executes the request - */ - DeleteIdentitySessionsExecute(r IdentityApiApiDeleteIdentitySessionsRequest) (*http.Response, error) + Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity. - /* - * DisableSession Deactivate a Session - * Calling this endpoint deactivates the specified session. Session data is not deleted. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the session's ID. - * @return IdentityApiApiDisableSessionRequest - */ - DisableSession(ctx context.Context, id string) IdentityApiApiDisableSessionRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @return IdentityApiDeleteIdentitySessionsRequest + */ + DeleteIdentitySessions(ctx context.Context, id string) IdentityApiDeleteIdentitySessionsRequest + + // DeleteIdentitySessionsExecute executes the request + DeleteIdentitySessionsExecute(r IdentityApiDeleteIdentitySessionsRequest) (*http.Response, error) /* - * DisableSessionExecute executes the request - */ - DisableSessionExecute(r IdentityApiApiDisableSessionRequest) (*http.Response, error) + DisableSession Deactivate a Session + + Calling this endpoint deactivates the specified session. Session data is not deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return IdentityApiDisableSessionRequest + */ + DisableSession(ctx context.Context, id string) IdentityApiDisableSessionRequest + + // DisableSessionExecute executes the request + DisableSessionExecute(r IdentityApiDisableSessionRequest) (*http.Response, error) /* - * ExtendSession Extend a Session - * Calling this endpoint extends the given session ID. If `session.earliest_possible_extend` is set it + ExtendSession Extend a Session + + Calling this endpoint extends the given session ID. If `session.earliest_possible_extend` is set it will only extend the session after the specified time has passed. Retrieve the session ID from the `/sessions/whoami` endpoint / `toSession` SDK method. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the session's ID. - * @return IdentityApiApiExtendSessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return IdentityApiExtendSessionRequest */ - ExtendSession(ctx context.Context, id string) IdentityApiApiExtendSessionRequest + ExtendSession(ctx context.Context, id string) IdentityApiExtendSessionRequest - /* - * ExtendSessionExecute executes the request - * @return Session - */ - ExtendSessionExecute(r IdentityApiApiExtendSessionRequest) (*Session, *http.Response, error) + // ExtendSessionExecute executes the request + // @return Session + ExtendSessionExecute(r IdentityApiExtendSessionRequest) (*Session, *http.Response, error) /* - * GetIdentity Get an Identity - * Return an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) by its ID. You can optionally + GetIdentity Get an Identity + + Return an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) by its ID. You can optionally include credentials (e.g. social sign in connections) in the response by using the `include_credential` query parameter. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID must be set to the ID of identity you want to get - * @return IdentityApiApiGetIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of identity you want to get + @return IdentityApiGetIdentityRequest */ - GetIdentity(ctx context.Context, id string) IdentityApiApiGetIdentityRequest + GetIdentity(ctx context.Context, id string) IdentityApiGetIdentityRequest - /* - * GetIdentityExecute executes the request - * @return Identity - */ - GetIdentityExecute(r IdentityApiApiGetIdentityRequest) (*Identity, *http.Response, error) + // GetIdentityExecute executes the request + // @return Identity + GetIdentityExecute(r IdentityApiGetIdentityRequest) (*Identity, *http.Response, error) /* - * GetIdentitySchema Get Identity JSON Schema - * Return a specific identity schema. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID must be set to the ID of schema you want to get - * @return IdentityApiApiGetIdentitySchemaRequest - */ - GetIdentitySchema(ctx context.Context, id string) IdentityApiApiGetIdentitySchemaRequest + GetIdentitySchema Get Identity JSON Schema - /* - * GetIdentitySchemaExecute executes the request - * @return map[string]interface{} - */ - GetIdentitySchemaExecute(r IdentityApiApiGetIdentitySchemaRequest) (map[string]interface{}, *http.Response, error) + Return a specific identity schema. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of schema you want to get + @return IdentityApiGetIdentitySchemaRequest + */ + GetIdentitySchema(ctx context.Context, id string) IdentityApiGetIdentitySchemaRequest + + // GetIdentitySchemaExecute executes the request + // @return map[string]interface{} + GetIdentitySchemaExecute(r IdentityApiGetIdentitySchemaRequest) (map[string]interface{}, *http.Response, error) /* - * GetSession Get Session - * This endpoint is useful for: + GetSession Get Session + + This endpoint is useful for: Getting a session object with all specified expandables that exist in an administrative context. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the session's ID. - * @return IdentityApiApiGetSessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return IdentityApiGetSessionRequest */ - GetSession(ctx context.Context, id string) IdentityApiApiGetSessionRequest + GetSession(ctx context.Context, id string) IdentityApiGetSessionRequest - /* - * GetSessionExecute executes the request - * @return Session - */ - GetSessionExecute(r IdentityApiApiGetSessionRequest) (*Session, *http.Response, error) + // GetSessionExecute executes the request + // @return Session + GetSessionExecute(r IdentityApiGetSessionRequest) (*Session, *http.Response, error) /* - * ListIdentities List Identities - * Lists all [identities](https://www.ory.sh/docs/kratos/concepts/identity-user-model) in the system. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiListIdentitiesRequest - */ - ListIdentities(ctx context.Context) IdentityApiApiListIdentitiesRequest + ListIdentities List Identities - /* - * ListIdentitiesExecute executes the request - * @return []Identity - */ - ListIdentitiesExecute(r IdentityApiApiListIdentitiesRequest) ([]Identity, *http.Response, error) + Lists all [identities](https://www.ory.sh/docs/kratos/concepts/identity-user-model) in the system. - /* - * ListIdentitySchemas Get all Identity Schemas - * Returns a list of all identity schemas currently in use. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiListIdentitySchemasRequest - */ - ListIdentitySchemas(ctx context.Context) IdentityApiApiListIdentitySchemasRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiListIdentitiesRequest + */ + ListIdentities(ctx context.Context) IdentityApiListIdentitiesRequest - /* - * ListIdentitySchemasExecute executes the request - * @return []IdentitySchemaContainer - */ - ListIdentitySchemasExecute(r IdentityApiApiListIdentitySchemasRequest) ([]IdentitySchemaContainer, *http.Response, error) + // ListIdentitiesExecute executes the request + // @return []Identity + ListIdentitiesExecute(r IdentityApiListIdentitiesRequest) ([]Identity, *http.Response, error) /* - * ListIdentitySessions List an Identity's Sessions - * This endpoint returns all sessions that belong to the given Identity. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the identity's ID. - * @return IdentityApiApiListIdentitySessionsRequest - */ - ListIdentitySessions(ctx context.Context, id string) IdentityApiApiListIdentitySessionsRequest + ListIdentitySchemas Get all Identity Schemas - /* - * ListIdentitySessionsExecute executes the request - * @return []Session - */ - ListIdentitySessionsExecute(r IdentityApiApiListIdentitySessionsRequest) ([]Session, *http.Response, error) + Returns a list of all identity schemas currently in use. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiListIdentitySchemasRequest + */ + ListIdentitySchemas(ctx context.Context) IdentityApiListIdentitySchemasRequest + + // ListIdentitySchemasExecute executes the request + // @return []IdentitySchemaContainer + ListIdentitySchemasExecute(r IdentityApiListIdentitySchemasRequest) ([]IdentitySchemaContainer, *http.Response, error) /* - * ListSessions List All Sessions - * Listing all sessions that exist. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiListSessionsRequest - */ - ListSessions(ctx context.Context) IdentityApiApiListSessionsRequest + ListIdentitySessions List an Identity's Sessions + + This endpoint returns all sessions that belong to the given Identity. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @return IdentityApiListIdentitySessionsRequest + */ + ListIdentitySessions(ctx context.Context, id string) IdentityApiListIdentitySessionsRequest + + // ListIdentitySessionsExecute executes the request + // @return []Session + ListIdentitySessionsExecute(r IdentityApiListIdentitySessionsRequest) ([]Session, *http.Response, error) /* - * ListSessionsExecute executes the request - * @return []Session - */ - ListSessionsExecute(r IdentityApiApiListSessionsRequest) ([]Session, *http.Response, error) + ListSessions List All Sessions + + Listing all sessions that exist. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiListSessionsRequest + */ + ListSessions(ctx context.Context) IdentityApiListSessionsRequest + + // ListSessionsExecute executes the request + // @return []Session + ListSessionsExecute(r IdentityApiListSessionsRequest) ([]Session, *http.Response, error) /* - * PatchIdentity Patch an Identity - * Partially updates an [identity's](https://www.ory.sh/docs/kratos/concepts/identity-user-model) field using [JSON Patch](https://jsonpatch.com/). + PatchIdentity Patch an Identity + + Partially updates an [identity's](https://www.ory.sh/docs/kratos/concepts/identity-user-model) field using [JSON Patch](https://jsonpatch.com/). The fields `id`, `stateChangedAt` and `credentials` can not be updated using this method. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID must be set to the ID of identity you want to update - * @return IdentityApiApiPatchIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of identity you want to update + @return IdentityApiPatchIdentityRequest */ - PatchIdentity(ctx context.Context, id string) IdentityApiApiPatchIdentityRequest + PatchIdentity(ctx context.Context, id string) IdentityApiPatchIdentityRequest - /* - * PatchIdentityExecute executes the request - * @return Identity - */ - PatchIdentityExecute(r IdentityApiApiPatchIdentityRequest) (*Identity, *http.Response, error) + // PatchIdentityExecute executes the request + // @return Identity + PatchIdentityExecute(r IdentityApiPatchIdentityRequest) (*Identity, *http.Response, error) /* - * UpdateIdentity Update an Identity - * This endpoint updates an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). The full identity + UpdateIdentity Update an Identity + + This endpoint updates an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). The full identity payload (except credentials) is expected. It is possible to update the identity's credentials as well. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID must be set to the ID of identity you want to update - * @return IdentityApiApiUpdateIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of identity you want to update + @return IdentityApiUpdateIdentityRequest */ - UpdateIdentity(ctx context.Context, id string) IdentityApiApiUpdateIdentityRequest + UpdateIdentity(ctx context.Context, id string) IdentityApiUpdateIdentityRequest - /* - * UpdateIdentityExecute executes the request - * @return Identity - */ - UpdateIdentityExecute(r IdentityApiApiUpdateIdentityRequest) (*Identity, *http.Response, error) + // UpdateIdentityExecute executes the request + // @return Identity + UpdateIdentityExecute(r IdentityApiUpdateIdentityRequest) (*Identity, *http.Response, error) } // IdentityApiService IdentityApi service type IdentityApiService service -type IdentityApiApiBatchPatchIdentitiesRequest struct { +type IdentityApiBatchPatchIdentitiesRequest struct { ctx context.Context ApiService IdentityApi patchIdentitiesBody *PatchIdentitiesBody } -func (r IdentityApiApiBatchPatchIdentitiesRequest) PatchIdentitiesBody(patchIdentitiesBody PatchIdentitiesBody) IdentityApiApiBatchPatchIdentitiesRequest { +func (r IdentityApiBatchPatchIdentitiesRequest) PatchIdentitiesBody(patchIdentitiesBody PatchIdentitiesBody) IdentityApiBatchPatchIdentitiesRequest { r.patchIdentitiesBody = &patchIdentitiesBody return r } -func (r IdentityApiApiBatchPatchIdentitiesRequest) Execute() (*BatchPatchIdentitiesResponse, *http.Response, error) { +func (r IdentityApiBatchPatchIdentitiesRequest) Execute() (*BatchPatchIdentitiesResponse, *http.Response, error) { return r.ApiService.BatchPatchIdentitiesExecute(r) } /* - - BatchPatchIdentities Create and deletes multiple identities - - Creates or delete multiple +BatchPatchIdentities Create and deletes multiple identities +Creates or delete multiple [identities](https://www.ory.sh/docs/kratos/concepts/identity-user-model). This endpoint can also be used to [import credentials](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities) for instance passwords, social sign in configurations or multifactor methods. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return IdentityApiApiBatchPatchIdentitiesRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiBatchPatchIdentitiesRequest */ -func (a *IdentityApiService) BatchPatchIdentities(ctx context.Context) IdentityApiApiBatchPatchIdentitiesRequest { - return IdentityApiApiBatchPatchIdentitiesRequest{ +func (a *IdentityApiService) BatchPatchIdentities(ctx context.Context) IdentityApiBatchPatchIdentitiesRequest { + return IdentityApiBatchPatchIdentitiesRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return BatchPatchIdentitiesResponse - */ -func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiApiBatchPatchIdentitiesRequest) (*BatchPatchIdentitiesResponse, *http.Response, error) { +// Execute executes the request +// +// @return BatchPatchIdentitiesResponse +func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiBatchPatchIdentitiesRequest) (*BatchPatchIdentitiesResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPatch - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *BatchPatchIdentitiesResponse + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BatchPatchIdentitiesResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.BatchPatchIdentities") @@ -402,7 +395,7 @@ func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiApiBatchPa } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -431,6 +424,7 @@ func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiApiBatchPa newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -441,6 +435,7 @@ func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiApiBatchPa newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -450,6 +445,7 @@ func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiApiBatchPa newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -466,49 +462,47 @@ func (a *IdentityApiService) BatchPatchIdentitiesExecute(r IdentityApiApiBatchPa return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiCreateIdentityRequest struct { +type IdentityApiCreateIdentityRequest struct { ctx context.Context ApiService IdentityApi createIdentityBody *CreateIdentityBody } -func (r IdentityApiApiCreateIdentityRequest) CreateIdentityBody(createIdentityBody CreateIdentityBody) IdentityApiApiCreateIdentityRequest { +func (r IdentityApiCreateIdentityRequest) CreateIdentityBody(createIdentityBody CreateIdentityBody) IdentityApiCreateIdentityRequest { r.createIdentityBody = &createIdentityBody return r } -func (r IdentityApiApiCreateIdentityRequest) Execute() (*Identity, *http.Response, error) { +func (r IdentityApiCreateIdentityRequest) Execute() (*Identity, *http.Response, error) { return r.ApiService.CreateIdentityExecute(r) } /* - - CreateIdentity Create an Identity - - Create an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). This endpoint can also be used to +CreateIdentity Create an Identity +Create an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). This endpoint can also be used to [import credentials](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities) for instance passwords, social sign in configurations or multifactor methods. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return IdentityApiApiCreateIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiCreateIdentityRequest */ -func (a *IdentityApiService) CreateIdentity(ctx context.Context) IdentityApiApiCreateIdentityRequest { - return IdentityApiApiCreateIdentityRequest{ +func (a *IdentityApiService) CreateIdentity(ctx context.Context) IdentityApiCreateIdentityRequest { + return IdentityApiCreateIdentityRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return Identity - */ -func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiApiCreateIdentityRequest) (*Identity, *http.Response, error) { +// Execute executes the request +// +// @return Identity +func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiCreateIdentityRequest) (*Identity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Identity + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Identity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.CreateIdentity") @@ -555,7 +549,7 @@ func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiApiCreateIdentit } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -584,6 +578,7 @@ func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiApiCreateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -594,6 +589,7 @@ func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiApiCreateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -603,6 +599,7 @@ func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiApiCreateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -619,48 +616,46 @@ func (a *IdentityApiService) CreateIdentityExecute(r IdentityApiApiCreateIdentit return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiCreateRecoveryCodeForIdentityRequest struct { +type IdentityApiCreateRecoveryCodeForIdentityRequest struct { ctx context.Context ApiService IdentityApi createRecoveryCodeForIdentityBody *CreateRecoveryCodeForIdentityBody } -func (r IdentityApiApiCreateRecoveryCodeForIdentityRequest) CreateRecoveryCodeForIdentityBody(createRecoveryCodeForIdentityBody CreateRecoveryCodeForIdentityBody) IdentityApiApiCreateRecoveryCodeForIdentityRequest { +func (r IdentityApiCreateRecoveryCodeForIdentityRequest) CreateRecoveryCodeForIdentityBody(createRecoveryCodeForIdentityBody CreateRecoveryCodeForIdentityBody) IdentityApiCreateRecoveryCodeForIdentityRequest { r.createRecoveryCodeForIdentityBody = &createRecoveryCodeForIdentityBody return r } -func (r IdentityApiApiCreateRecoveryCodeForIdentityRequest) Execute() (*RecoveryCodeForIdentity, *http.Response, error) { +func (r IdentityApiCreateRecoveryCodeForIdentityRequest) Execute() (*RecoveryCodeForIdentity, *http.Response, error) { return r.ApiService.CreateRecoveryCodeForIdentityExecute(r) } /* - - CreateRecoveryCodeForIdentity Create a Recovery Code - - This endpoint creates a recovery code which should be given to the user in order for them to recover +CreateRecoveryCodeForIdentity Create a Recovery Code +This endpoint creates a recovery code which should be given to the user in order for them to recover (or activate) their account. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return IdentityApiApiCreateRecoveryCodeForIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiCreateRecoveryCodeForIdentityRequest */ -func (a *IdentityApiService) CreateRecoveryCodeForIdentity(ctx context.Context) IdentityApiApiCreateRecoveryCodeForIdentityRequest { - return IdentityApiApiCreateRecoveryCodeForIdentityRequest{ +func (a *IdentityApiService) CreateRecoveryCodeForIdentity(ctx context.Context) IdentityApiCreateRecoveryCodeForIdentityRequest { + return IdentityApiCreateRecoveryCodeForIdentityRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RecoveryCodeForIdentity - */ -func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiApiCreateRecoveryCodeForIdentityRequest) (*RecoveryCodeForIdentity, *http.Response, error) { +// Execute executes the request +// +// @return RecoveryCodeForIdentity +func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiCreateRecoveryCodeForIdentityRequest) (*RecoveryCodeForIdentity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RecoveryCodeForIdentity + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryCodeForIdentity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.CreateRecoveryCodeForIdentity") @@ -707,7 +702,7 @@ func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiA } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -736,6 +731,7 @@ func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -746,6 +742,7 @@ func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -755,6 +752,7 @@ func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -771,53 +769,52 @@ func (a *IdentityApiService) CreateRecoveryCodeForIdentityExecute(r IdentityApiA return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiCreateRecoveryLinkForIdentityRequest struct { +type IdentityApiCreateRecoveryLinkForIdentityRequest struct { ctx context.Context ApiService IdentityApi returnTo *string createRecoveryLinkForIdentityBody *CreateRecoveryLinkForIdentityBody } -func (r IdentityApiApiCreateRecoveryLinkForIdentityRequest) ReturnTo(returnTo string) IdentityApiApiCreateRecoveryLinkForIdentityRequest { +func (r IdentityApiCreateRecoveryLinkForIdentityRequest) ReturnTo(returnTo string) IdentityApiCreateRecoveryLinkForIdentityRequest { r.returnTo = &returnTo return r } -func (r IdentityApiApiCreateRecoveryLinkForIdentityRequest) CreateRecoveryLinkForIdentityBody(createRecoveryLinkForIdentityBody CreateRecoveryLinkForIdentityBody) IdentityApiApiCreateRecoveryLinkForIdentityRequest { + +func (r IdentityApiCreateRecoveryLinkForIdentityRequest) CreateRecoveryLinkForIdentityBody(createRecoveryLinkForIdentityBody CreateRecoveryLinkForIdentityBody) IdentityApiCreateRecoveryLinkForIdentityRequest { r.createRecoveryLinkForIdentityBody = &createRecoveryLinkForIdentityBody return r } -func (r IdentityApiApiCreateRecoveryLinkForIdentityRequest) Execute() (*RecoveryLinkForIdentity, *http.Response, error) { +func (r IdentityApiCreateRecoveryLinkForIdentityRequest) Execute() (*RecoveryLinkForIdentity, *http.Response, error) { return r.ApiService.CreateRecoveryLinkForIdentityExecute(r) } /* - - CreateRecoveryLinkForIdentity Create a Recovery Link - - This endpoint creates a recovery link which should be given to the user in order for them to recover +CreateRecoveryLinkForIdentity Create a Recovery Link +This endpoint creates a recovery link which should be given to the user in order for them to recover (or activate) their account. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return IdentityApiApiCreateRecoveryLinkForIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiCreateRecoveryLinkForIdentityRequest */ -func (a *IdentityApiService) CreateRecoveryLinkForIdentity(ctx context.Context) IdentityApiApiCreateRecoveryLinkForIdentityRequest { - return IdentityApiApiCreateRecoveryLinkForIdentityRequest{ +func (a *IdentityApiService) CreateRecoveryLinkForIdentity(ctx context.Context) IdentityApiCreateRecoveryLinkForIdentityRequest { + return IdentityApiCreateRecoveryLinkForIdentityRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return RecoveryLinkForIdentity - */ -func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiApiCreateRecoveryLinkForIdentityRequest) (*RecoveryLinkForIdentity, *http.Response, error) { +// Execute executes the request +// +// @return RecoveryLinkForIdentity +func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiCreateRecoveryLinkForIdentityRequest) (*RecoveryLinkForIdentity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RecoveryLinkForIdentity + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryLinkForIdentity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.CreateRecoveryLinkForIdentity") @@ -832,7 +829,7 @@ func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiA localVarFormParams := url.Values{} if r.returnTo != nil { - localVarQueryParams.Add("return_to", parameterToString(*r.returnTo, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "return_to", r.returnTo, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -867,7 +864,7 @@ func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiA } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -896,6 +893,7 @@ func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -906,6 +904,7 @@ func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -915,6 +914,7 @@ func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiA newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -931,44 +931,41 @@ func (a *IdentityApiService) CreateRecoveryLinkForIdentityExecute(r IdentityApiA return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiDeleteIdentityRequest struct { +type IdentityApiDeleteIdentityRequest struct { ctx context.Context ApiService IdentityApi id string } -func (r IdentityApiApiDeleteIdentityRequest) Execute() (*http.Response, error) { +func (r IdentityApiDeleteIdentityRequest) Execute() (*http.Response, error) { return r.ApiService.DeleteIdentityExecute(r) } /* - - DeleteIdentity Delete an Identity - - Calling this endpoint irrecoverably and permanently deletes the [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) given its ID. This action can not be undone. +DeleteIdentity Delete an Identity +Calling this endpoint irrecoverably and permanently deletes the [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) given its ID. This action can not be undone. This endpoint returns 204 when the identity was deleted or when the identity was not found, in which case it is assumed that is has been deleted already. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID is the identity's ID. - - @return IdentityApiApiDeleteIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @return IdentityApiDeleteIdentityRequest */ -func (a *IdentityApiService) DeleteIdentity(ctx context.Context, id string) IdentityApiApiDeleteIdentityRequest { - return IdentityApiApiDeleteIdentityRequest{ +func (a *IdentityApiService) DeleteIdentity(ctx context.Context, id string) IdentityApiDeleteIdentityRequest { + return IdentityApiDeleteIdentityRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - */ -func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiApiDeleteIdentityRequest) (*http.Response, error) { +// Execute executes the request +func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiDeleteIdentityRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.DeleteIdentity") @@ -977,7 +974,7 @@ func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiApiDeleteIdentit } localVarPath := localBasePath + "/admin/identities/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1014,7 +1011,7 @@ func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiApiDeleteIdentit } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -1043,6 +1040,7 @@ func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiApiDeleteIdentit newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1052,6 +1050,7 @@ func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiApiDeleteIdentit newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1059,29 +1058,30 @@ func (a *IdentityApiService) DeleteIdentityExecute(r IdentityApiApiDeleteIdentit return localVarHTTPResponse, nil } -type IdentityApiApiDeleteIdentityCredentialsRequest struct { +type IdentityApiDeleteIdentityCredentialsRequest struct { ctx context.Context ApiService IdentityApi id string type_ string } -func (r IdentityApiApiDeleteIdentityCredentialsRequest) Execute() (*http.Response, error) { +func (r IdentityApiDeleteIdentityCredentialsRequest) Execute() (*http.Response, error) { return r.ApiService.DeleteIdentityCredentialsExecute(r) } /* - - DeleteIdentityCredentials Delete a credential for a specific identity - - Delete an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) credential by its type +DeleteIdentityCredentials Delete a credential for a specific identity +Delete an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) credential by its type You can only delete second factor (aal2) credentials. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID is the identity's ID. - - @param type_ Type is the type of credentials to be deleted. password CredentialsTypePassword oidc CredentialsTypeOIDC totp CredentialsTypeTOTP lookup_secret CredentialsTypeLookup webauthn CredentialsTypeWebAuthn code CredentialsTypeCodeAuth link_recovery CredentialsTypeRecoveryLink CredentialsTypeRecoveryLink is a special credential type linked to the link strategy (recovery flow). It is not used within the credentials object itself. code_recovery CredentialsTypeRecoveryCode - - @return IdentityApiApiDeleteIdentityCredentialsRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @param type_ Type is the type of credentials to be deleted. password CredentialsTypePassword oidc CredentialsTypeOIDC totp CredentialsTypeTOTP lookup_secret CredentialsTypeLookup webauthn CredentialsTypeWebAuthn code CredentialsTypeCodeAuth link_recovery CredentialsTypeRecoveryLink CredentialsTypeRecoveryLink is a special credential type linked to the link strategy (recovery flow). It is not used within the credentials object itself. code_recovery CredentialsTypeRecoveryCode + @return IdentityApiDeleteIdentityCredentialsRequest */ -func (a *IdentityApiService) DeleteIdentityCredentials(ctx context.Context, id string, type_ string) IdentityApiApiDeleteIdentityCredentialsRequest { - return IdentityApiApiDeleteIdentityCredentialsRequest{ +func (a *IdentityApiService) DeleteIdentityCredentials(ctx context.Context, id string, type_ string) IdentityApiDeleteIdentityCredentialsRequest { + return IdentityApiDeleteIdentityCredentialsRequest{ ApiService: a, ctx: ctx, id: id, @@ -1089,16 +1089,12 @@ func (a *IdentityApiService) DeleteIdentityCredentials(ctx context.Context, id s } } -/* - * Execute executes the request - */ -func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiApiDeleteIdentityCredentialsRequest) (*http.Response, error) { +// Execute executes the request +func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiDeleteIdentityCredentialsRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.DeleteIdentityCredentials") @@ -1107,8 +1103,8 @@ func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiApiDe } localVarPath := localBasePath + "/admin/identities/{id}/credentials/{type}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"type"+"}", url.PathEscape(parameterToString(r.type_, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"type"+"}", url.PathEscape(parameterValueToString(r.type_, "type_")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1145,7 +1141,7 @@ func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiApiDe } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -1174,6 +1170,7 @@ func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiApiDe newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1183,6 +1180,7 @@ func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiApiDe newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1190,41 +1188,39 @@ func (a *IdentityApiService) DeleteIdentityCredentialsExecute(r IdentityApiApiDe return localVarHTTPResponse, nil } -type IdentityApiApiDeleteIdentitySessionsRequest struct { +type IdentityApiDeleteIdentitySessionsRequest struct { ctx context.Context ApiService IdentityApi id string } -func (r IdentityApiApiDeleteIdentitySessionsRequest) Execute() (*http.Response, error) { +func (r IdentityApiDeleteIdentitySessionsRequest) Execute() (*http.Response, error) { return r.ApiService.DeleteIdentitySessionsExecute(r) } /* - * DeleteIdentitySessions Delete & Invalidate an Identity's Sessions - * Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the identity's ID. - * @return IdentityApiApiDeleteIdentitySessionsRequest - */ -func (a *IdentityApiService) DeleteIdentitySessions(ctx context.Context, id string) IdentityApiApiDeleteIdentitySessionsRequest { - return IdentityApiApiDeleteIdentitySessionsRequest{ +DeleteIdentitySessions Delete & Invalidate an Identity's Sessions + +Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @return IdentityApiDeleteIdentitySessionsRequest +*/ +func (a *IdentityApiService) DeleteIdentitySessions(ctx context.Context, id string) IdentityApiDeleteIdentitySessionsRequest { + return IdentityApiDeleteIdentitySessionsRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - */ -func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDeleteIdentitySessionsRequest) (*http.Response, error) { +// Execute executes the request +func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiDeleteIdentitySessionsRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.DeleteIdentitySessions") @@ -1233,7 +1229,7 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet } localVarPath := localBasePath + "/admin/identities/{id}/sessions" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1270,7 +1266,7 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -1299,6 +1295,7 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1309,6 +1306,7 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1319,6 +1317,7 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1328,6 +1327,7 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1335,41 +1335,39 @@ func (a *IdentityApiService) DeleteIdentitySessionsExecute(r IdentityApiApiDelet return localVarHTTPResponse, nil } -type IdentityApiApiDisableSessionRequest struct { +type IdentityApiDisableSessionRequest struct { ctx context.Context ApiService IdentityApi id string } -func (r IdentityApiApiDisableSessionRequest) Execute() (*http.Response, error) { +func (r IdentityApiDisableSessionRequest) Execute() (*http.Response, error) { return r.ApiService.DisableSessionExecute(r) } /* - * DisableSession Deactivate a Session - * Calling this endpoint deactivates the specified session. Session data is not deleted. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the session's ID. - * @return IdentityApiApiDisableSessionRequest - */ -func (a *IdentityApiService) DisableSession(ctx context.Context, id string) IdentityApiApiDisableSessionRequest { - return IdentityApiApiDisableSessionRequest{ +DisableSession Deactivate a Session + +Calling this endpoint deactivates the specified session. Session data is not deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return IdentityApiDisableSessionRequest +*/ +func (a *IdentityApiService) DisableSession(ctx context.Context, id string) IdentityApiDisableSessionRequest { + return IdentityApiDisableSessionRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - */ -func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessionRequest) (*http.Response, error) { +// Execute executes the request +func (a *IdentityApiService) DisableSessionExecute(r IdentityApiDisableSessionRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.DisableSession") @@ -1378,7 +1376,7 @@ func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessio } localVarPath := localBasePath + "/admin/sessions/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1415,7 +1413,7 @@ func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessio } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } @@ -1444,6 +1442,7 @@ func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessio newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1454,6 +1453,7 @@ func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessio newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1463,6 +1463,7 @@ func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessio newErr.error = err.Error() return localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarHTTPResponse, newErr } @@ -1470,47 +1471,45 @@ func (a *IdentityApiService) DisableSessionExecute(r IdentityApiApiDisableSessio return localVarHTTPResponse, nil } -type IdentityApiApiExtendSessionRequest struct { +type IdentityApiExtendSessionRequest struct { ctx context.Context ApiService IdentityApi id string } -func (r IdentityApiApiExtendSessionRequest) Execute() (*Session, *http.Response, error) { +func (r IdentityApiExtendSessionRequest) Execute() (*Session, *http.Response, error) { return r.ApiService.ExtendSessionExecute(r) } /* - - ExtendSession Extend a Session - - Calling this endpoint extends the given session ID. If `session.earliest_possible_extend` is set it +ExtendSession Extend a Session +Calling this endpoint extends the given session ID. If `session.earliest_possible_extend` is set it will only extend the session after the specified time has passed. Retrieve the session ID from the `/sessions/whoami` endpoint / `toSession` SDK method. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID is the session's ID. - - @return IdentityApiApiExtendSessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return IdentityApiExtendSessionRequest */ -func (a *IdentityApiService) ExtendSession(ctx context.Context, id string) IdentityApiApiExtendSessionRequest { - return IdentityApiApiExtendSessionRequest{ +func (a *IdentityApiService) ExtendSession(ctx context.Context, id string) IdentityApiExtendSessionRequest { + return IdentityApiExtendSessionRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return Session - */ -func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionRequest) (*Session, *http.Response, error) { +// Execute executes the request +// +// @return Session +func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiExtendSessionRequest) (*Session, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPatch - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Session + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Session ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.ExtendSession") @@ -1519,7 +1518,7 @@ func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionR } localVarPath := localBasePath + "/admin/sessions/{id}/extend" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1556,7 +1555,7 @@ func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionR } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1585,6 +1584,7 @@ func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1595,6 +1595,7 @@ func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1604,6 +1605,7 @@ func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1620,51 +1622,50 @@ func (a *IdentityApiService) ExtendSessionExecute(r IdentityApiApiExtendSessionR return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiGetIdentityRequest struct { +type IdentityApiGetIdentityRequest struct { ctx context.Context ApiService IdentityApi id string includeCredential *[]string } -func (r IdentityApiApiGetIdentityRequest) IncludeCredential(includeCredential []string) IdentityApiApiGetIdentityRequest { +// Include Credentials in Response Include any credential, for example `password` or `oidc`, in the response. When set to `oidc`, This will return the initial OAuth 2.0 Access Token, OAuth 2.0 Refresh Token and the OpenID Connect ID Token if available. +func (r IdentityApiGetIdentityRequest) IncludeCredential(includeCredential []string) IdentityApiGetIdentityRequest { r.includeCredential = &includeCredential return r } -func (r IdentityApiApiGetIdentityRequest) Execute() (*Identity, *http.Response, error) { +func (r IdentityApiGetIdentityRequest) Execute() (*Identity, *http.Response, error) { return r.ApiService.GetIdentityExecute(r) } /* - - GetIdentity Get an Identity - - Return an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) by its ID. You can optionally +GetIdentity Get an Identity +Return an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) by its ID. You can optionally include credentials (e.g. social sign in connections) in the response by using the `include_credential` query parameter. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID must be set to the ID of identity you want to get - - @return IdentityApiApiGetIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of identity you want to get + @return IdentityApiGetIdentityRequest */ -func (a *IdentityApiService) GetIdentity(ctx context.Context, id string) IdentityApiApiGetIdentityRequest { - return IdentityApiApiGetIdentityRequest{ +func (a *IdentityApiService) GetIdentity(ctx context.Context, id string) IdentityApiGetIdentityRequest { + return IdentityApiGetIdentityRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return Identity - */ -func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityRequest) (*Identity, *http.Response, error) { +// Execute executes the request +// +// @return Identity +func (a *IdentityApiService) GetIdentityExecute(r IdentityApiGetIdentityRequest) (*Identity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Identity + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Identity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.GetIdentity") @@ -1673,7 +1674,7 @@ func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityReque } localVarPath := localBasePath + "/admin/identities/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1684,10 +1685,10 @@ func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityReque if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("include_credential", parameterToString(s.Index(i), "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "include_credential", s.Index(i).Interface(), "multi") } } else { - localVarQueryParams.Add("include_credential", parameterToString(t, "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "include_credential", t, "multi") } } // to determine the Content-Type header @@ -1721,7 +1722,7 @@ func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityReque } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1750,6 +1751,7 @@ func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityReque newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1759,6 +1761,7 @@ func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityReque newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1775,43 +1778,42 @@ func (a *IdentityApiService) GetIdentityExecute(r IdentityApiApiGetIdentityReque return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiGetIdentitySchemaRequest struct { +type IdentityApiGetIdentitySchemaRequest struct { ctx context.Context ApiService IdentityApi id string } -func (r IdentityApiApiGetIdentitySchemaRequest) Execute() (map[string]interface{}, *http.Response, error) { +func (r IdentityApiGetIdentitySchemaRequest) Execute() (map[string]interface{}, *http.Response, error) { return r.ApiService.GetIdentitySchemaExecute(r) } /* - * GetIdentitySchema Get Identity JSON Schema - * Return a specific identity schema. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID must be set to the ID of schema you want to get - * @return IdentityApiApiGetIdentitySchemaRequest - */ -func (a *IdentityApiService) GetIdentitySchema(ctx context.Context, id string) IdentityApiApiGetIdentitySchemaRequest { - return IdentityApiApiGetIdentitySchemaRequest{ +GetIdentitySchema Get Identity JSON Schema + +Return a specific identity schema. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of schema you want to get + @return IdentityApiGetIdentitySchemaRequest +*/ +func (a *IdentityApiService) GetIdentitySchema(ctx context.Context, id string) IdentityApiGetIdentitySchemaRequest { + return IdentityApiGetIdentitySchemaRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return map[string]interface{} - */ -func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiApiGetIdentitySchemaRequest) (map[string]interface{}, *http.Response, error) { +// Execute executes the request +// +// @return map[string]interface{} +func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiGetIdentitySchemaRequest) (map[string]interface{}, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue map[string]interface{} + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.GetIdentitySchema") @@ -1820,7 +1822,7 @@ func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiApiGetIdentit } localVarPath := localBasePath + "/schemas/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1843,7 +1845,7 @@ func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiApiGetIdentit if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -1872,6 +1874,7 @@ func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiApiGetIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1881,6 +1884,7 @@ func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiApiGetIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1897,51 +1901,51 @@ func (a *IdentityApiService) GetIdentitySchemaExecute(r IdentityApiApiGetIdentit return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiGetSessionRequest struct { +type IdentityApiGetSessionRequest struct { ctx context.Context ApiService IdentityApi id string expand *[]string } -func (r IdentityApiApiGetSessionRequest) Expand(expand []string) IdentityApiApiGetSessionRequest { +// ExpandOptions is a query parameter encoded list of all properties that must be expanded in the Session. Example - ?expand=Identity&expand=Devices If no value is provided, the expandable properties are skipped. +func (r IdentityApiGetSessionRequest) Expand(expand []string) IdentityApiGetSessionRequest { r.expand = &expand return r } -func (r IdentityApiApiGetSessionRequest) Execute() (*Session, *http.Response, error) { +func (r IdentityApiGetSessionRequest) Execute() (*Session, *http.Response, error) { return r.ApiService.GetSessionExecute(r) } /* - - GetSession Get Session - - This endpoint is useful for: +GetSession Get Session + +This endpoint is useful for: Getting a session object with all specified expandables that exist in an administrative context. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID is the session's ID. - - @return IdentityApiApiGetSessionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the session's ID. + @return IdentityApiGetSessionRequest */ -func (a *IdentityApiService) GetSession(ctx context.Context, id string) IdentityApiApiGetSessionRequest { - return IdentityApiApiGetSessionRequest{ +func (a *IdentityApiService) GetSession(ctx context.Context, id string) IdentityApiGetSessionRequest { + return IdentityApiGetSessionRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return Session - */ -func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest) (*Session, *http.Response, error) { +// Execute executes the request +// +// @return Session +func (a *IdentityApiService) GetSessionExecute(r IdentityApiGetSessionRequest) (*Session, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Session + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Session ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.GetSession") @@ -1950,7 +1954,7 @@ func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest } localVarPath := localBasePath + "/admin/sessions/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1961,10 +1965,10 @@ func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("expand", parameterToString(s.Index(i), "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "expand", s.Index(i).Interface(), "multi") } } else { - localVarQueryParams.Add("expand", parameterToString(t, "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "expand", t, "multi") } } // to determine the Content-Type header @@ -1998,7 +2002,7 @@ func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2027,6 +2031,7 @@ func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2036,6 +2041,7 @@ func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2052,7 +2058,7 @@ func (a *IdentityApiService) GetSessionExecute(r IdentityApiApiGetSessionRequest return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiListIdentitiesRequest struct { +type IdentityApiListIdentitiesRequest struct { ctx context.Context ApiService IdentityApi perPage *int64 @@ -2065,68 +2071,82 @@ type IdentityApiApiListIdentitiesRequest struct { previewCredentialsIdentifierSimilar *string } -func (r IdentityApiApiListIdentitiesRequest) PerPage(perPage int64) IdentityApiApiListIdentitiesRequest { +// Deprecated Items per Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This is the number of items per page. +func (r IdentityApiListIdentitiesRequest) PerPage(perPage int64) IdentityApiListIdentitiesRequest { r.perPage = &perPage return r } -func (r IdentityApiApiListIdentitiesRequest) Page(page int64) IdentityApiApiListIdentitiesRequest { + +// Deprecated Pagination Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the `Link` header. +func (r IdentityApiListIdentitiesRequest) Page(page int64) IdentityApiListIdentitiesRequest { r.page = &page return r } -func (r IdentityApiApiListIdentitiesRequest) PageSize(pageSize int64) IdentityApiApiListIdentitiesRequest { + +// Page Size This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListIdentitiesRequest) PageSize(pageSize int64) IdentityApiListIdentitiesRequest { r.pageSize = &pageSize return r } -func (r IdentityApiApiListIdentitiesRequest) PageToken(pageToken string) IdentityApiApiListIdentitiesRequest { + +// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListIdentitiesRequest) PageToken(pageToken string) IdentityApiListIdentitiesRequest { r.pageToken = &pageToken return r } -func (r IdentityApiApiListIdentitiesRequest) Consistency(consistency string) IdentityApiApiListIdentitiesRequest { + +// Read Consistency Level (preview) The read consistency level determines the consistency guarantee for reads: strong (slow): The read is guaranteed to return the most recent data committed at the start of the read. eventual (very fast): The result will return data that is about 4.8 seconds old. The default consistency guarantee can be changed in the Ory Network Console or using the Ory CLI with `ory patch project --replace '/previews/default_read_consistency_level=\"strong\"'`. Setting the default consistency level to `eventual` may cause regressions in the future as we add consistency controls to more APIs. Currently, the following APIs will be affected by this setting: `GET /admin/identities` This feature is in preview and only available in Ory Network. ConsistencyLevelUnset ConsistencyLevelUnset is the unset / default consistency level. strong ConsistencyLevelStrong ConsistencyLevelStrong is the strong consistency level. eventual ConsistencyLevelEventual ConsistencyLevelEventual is the eventual consistency level using follower read timestamps. +func (r IdentityApiListIdentitiesRequest) Consistency(consistency string) IdentityApiListIdentitiesRequest { r.consistency = &consistency return r } -func (r IdentityApiApiListIdentitiesRequest) Ids(ids []string) IdentityApiApiListIdentitiesRequest { + +// List of ids used to filter identities. If this list is empty, then no filter will be applied. +func (r IdentityApiListIdentitiesRequest) Ids(ids []string) IdentityApiListIdentitiesRequest { r.ids = &ids return r } -func (r IdentityApiApiListIdentitiesRequest) CredentialsIdentifier(credentialsIdentifier string) IdentityApiApiListIdentitiesRequest { + +// CredentialsIdentifier is the identifier (username, email) of the credentials to look up using exact match. Only one of CredentialsIdentifier and CredentialsIdentifierSimilar can be used. +func (r IdentityApiListIdentitiesRequest) CredentialsIdentifier(credentialsIdentifier string) IdentityApiListIdentitiesRequest { r.credentialsIdentifier = &credentialsIdentifier return r } -func (r IdentityApiApiListIdentitiesRequest) PreviewCredentialsIdentifierSimilar(previewCredentialsIdentifierSimilar string) IdentityApiApiListIdentitiesRequest { + +// This is an EXPERIMENTAL parameter that WILL CHANGE. Do NOT rely on consistent, deterministic behavior. THIS PARAMETER WILL BE REMOVED IN AN UPCOMING RELEASE WITHOUT ANY MIGRATION PATH. CredentialsIdentifierSimilar is the (partial) identifier (username, email) of the credentials to look up using similarity search. Only one of CredentialsIdentifier and CredentialsIdentifierSimilar can be used. +func (r IdentityApiListIdentitiesRequest) PreviewCredentialsIdentifierSimilar(previewCredentialsIdentifierSimilar string) IdentityApiListIdentitiesRequest { r.previewCredentialsIdentifierSimilar = &previewCredentialsIdentifierSimilar return r } -func (r IdentityApiApiListIdentitiesRequest) Execute() ([]Identity, *http.Response, error) { +func (r IdentityApiListIdentitiesRequest) Execute() ([]Identity, *http.Response, error) { return r.ApiService.ListIdentitiesExecute(r) } /* - * ListIdentities List Identities - * Lists all [identities](https://www.ory.sh/docs/kratos/concepts/identity-user-model) in the system. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiListIdentitiesRequest - */ -func (a *IdentityApiService) ListIdentities(ctx context.Context) IdentityApiApiListIdentitiesRequest { - return IdentityApiApiListIdentitiesRequest{ +ListIdentities List Identities + +Lists all [identities](https://www.ory.sh/docs/kratos/concepts/identity-user-model) in the system. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiListIdentitiesRequest +*/ +func (a *IdentityApiService) ListIdentities(ctx context.Context) IdentityApiListIdentitiesRequest { + return IdentityApiListIdentitiesRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return []Identity - */ -func (a *IdentityApiService) ListIdentitiesExecute(r IdentityApiApiListIdentitiesRequest) ([]Identity, *http.Response, error) { +// Execute executes the request +// +// @return []Identity +func (a *IdentityApiService) ListIdentitiesExecute(r IdentityApiListIdentitiesRequest) ([]Identity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []Identity + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Identity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.ListIdentities") @@ -2141,36 +2161,45 @@ func (a *IdentityApiService) ListIdentitiesExecute(r IdentityApiApiListIdentitie localVarFormParams := url.Values{} if r.perPage != nil { - localVarQueryParams.Add("per_page", parameterToString(*r.perPage, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } else { + var defaultValue int64 = 250 + r.perPage = &defaultValue } if r.page != nil { - localVarQueryParams.Add("page", parameterToString(*r.page, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") } if r.pageSize != nil { - localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "") + } else { + var defaultValue int64 = 250 + r.pageSize = &defaultValue } if r.pageToken != nil { - localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "") + } else { + var defaultValue string = "1" + r.pageToken = &defaultValue } if r.consistency != nil { - localVarQueryParams.Add("consistency", parameterToString(*r.consistency, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "consistency", r.consistency, "") } if r.ids != nil { t := *r.ids if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("ids", parameterToString(s.Index(i), "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "ids", s.Index(i).Interface(), "multi") } } else { - localVarQueryParams.Add("ids", parameterToString(t, "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "ids", t, "multi") } } if r.credentialsIdentifier != nil { - localVarQueryParams.Add("credentials_identifier", parameterToString(*r.credentialsIdentifier, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "credentials_identifier", r.credentialsIdentifier, "") } if r.previewCredentialsIdentifierSimilar != nil { - localVarQueryParams.Add("preview_credentials_identifier_similar", parameterToString(*r.previewCredentialsIdentifierSimilar, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "preview_credentials_identifier_similar", r.previewCredentialsIdentifierSimilar, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2203,7 +2232,7 @@ func (a *IdentityApiService) ListIdentitiesExecute(r IdentityApiApiListIdentitie } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2231,6 +2260,7 @@ func (a *IdentityApiService) ListIdentitiesExecute(r IdentityApiApiListIdentitie newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2247,7 +2277,7 @@ func (a *IdentityApiService) ListIdentitiesExecute(r IdentityApiApiListIdentitie return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiListIdentitySchemasRequest struct { +type IdentityApiListIdentitySchemasRequest struct { ctx context.Context ApiService IdentityApi perPage *int64 @@ -2256,52 +2286,58 @@ type IdentityApiApiListIdentitySchemasRequest struct { pageToken *string } -func (r IdentityApiApiListIdentitySchemasRequest) PerPage(perPage int64) IdentityApiApiListIdentitySchemasRequest { +// Deprecated Items per Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This is the number of items per page. +func (r IdentityApiListIdentitySchemasRequest) PerPage(perPage int64) IdentityApiListIdentitySchemasRequest { r.perPage = &perPage return r } -func (r IdentityApiApiListIdentitySchemasRequest) Page(page int64) IdentityApiApiListIdentitySchemasRequest { + +// Deprecated Pagination Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the `Link` header. +func (r IdentityApiListIdentitySchemasRequest) Page(page int64) IdentityApiListIdentitySchemasRequest { r.page = &page return r } -func (r IdentityApiApiListIdentitySchemasRequest) PageSize(pageSize int64) IdentityApiApiListIdentitySchemasRequest { + +// Page Size This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListIdentitySchemasRequest) PageSize(pageSize int64) IdentityApiListIdentitySchemasRequest { r.pageSize = &pageSize return r } -func (r IdentityApiApiListIdentitySchemasRequest) PageToken(pageToken string) IdentityApiApiListIdentitySchemasRequest { + +// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListIdentitySchemasRequest) PageToken(pageToken string) IdentityApiListIdentitySchemasRequest { r.pageToken = &pageToken return r } -func (r IdentityApiApiListIdentitySchemasRequest) Execute() ([]IdentitySchemaContainer, *http.Response, error) { +func (r IdentityApiListIdentitySchemasRequest) Execute() ([]IdentitySchemaContainer, *http.Response, error) { return r.ApiService.ListIdentitySchemasExecute(r) } /* - * ListIdentitySchemas Get all Identity Schemas - * Returns a list of all identity schemas currently in use. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiListIdentitySchemasRequest - */ -func (a *IdentityApiService) ListIdentitySchemas(ctx context.Context) IdentityApiApiListIdentitySchemasRequest { - return IdentityApiApiListIdentitySchemasRequest{ +ListIdentitySchemas Get all Identity Schemas + +Returns a list of all identity schemas currently in use. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiListIdentitySchemasRequest +*/ +func (a *IdentityApiService) ListIdentitySchemas(ctx context.Context) IdentityApiListIdentitySchemasRequest { + return IdentityApiListIdentitySchemasRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return []IdentitySchemaContainer - */ -func (a *IdentityApiService) ListIdentitySchemasExecute(r IdentityApiApiListIdentitySchemasRequest) ([]IdentitySchemaContainer, *http.Response, error) { +// Execute executes the request +// +// @return []IdentitySchemaContainer +func (a *IdentityApiService) ListIdentitySchemasExecute(r IdentityApiListIdentitySchemasRequest) ([]IdentitySchemaContainer, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []IdentitySchemaContainer + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []IdentitySchemaContainer ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.ListIdentitySchemas") @@ -2316,16 +2352,25 @@ func (a *IdentityApiService) ListIdentitySchemasExecute(r IdentityApiApiListIden localVarFormParams := url.Values{} if r.perPage != nil { - localVarQueryParams.Add("per_page", parameterToString(*r.perPage, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } else { + var defaultValue int64 = 250 + r.perPage = &defaultValue } if r.page != nil { - localVarQueryParams.Add("page", parameterToString(*r.page, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") } if r.pageSize != nil { - localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "") + } else { + var defaultValue int64 = 250 + r.pageSize = &defaultValue } if r.pageToken != nil { - localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "") + } else { + var defaultValue string = "1" + r.pageToken = &defaultValue } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2344,7 +2389,7 @@ func (a *IdentityApiService) ListIdentitySchemasExecute(r IdentityApiApiListIden if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2372,6 +2417,7 @@ func (a *IdentityApiService) ListIdentitySchemasExecute(r IdentityApiApiListIden newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2388,7 +2434,7 @@ func (a *IdentityApiService) ListIdentitySchemasExecute(r IdentityApiApiListIden return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiListIdentitySessionsRequest struct { +type IdentityApiListIdentitySessionsRequest struct { ctx context.Context ApiService IdentityApi id string @@ -2399,58 +2445,66 @@ type IdentityApiApiListIdentitySessionsRequest struct { active *bool } -func (r IdentityApiApiListIdentitySessionsRequest) PerPage(perPage int64) IdentityApiApiListIdentitySessionsRequest { +// Deprecated Items per Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This is the number of items per page. +func (r IdentityApiListIdentitySessionsRequest) PerPage(perPage int64) IdentityApiListIdentitySessionsRequest { r.perPage = &perPage return r } -func (r IdentityApiApiListIdentitySessionsRequest) Page(page int64) IdentityApiApiListIdentitySessionsRequest { + +// Deprecated Pagination Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the `Link` header. +func (r IdentityApiListIdentitySessionsRequest) Page(page int64) IdentityApiListIdentitySessionsRequest { r.page = &page return r } -func (r IdentityApiApiListIdentitySessionsRequest) PageSize(pageSize int64) IdentityApiApiListIdentitySessionsRequest { + +// Page Size This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListIdentitySessionsRequest) PageSize(pageSize int64) IdentityApiListIdentitySessionsRequest { r.pageSize = &pageSize return r } -func (r IdentityApiApiListIdentitySessionsRequest) PageToken(pageToken string) IdentityApiApiListIdentitySessionsRequest { + +// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListIdentitySessionsRequest) PageToken(pageToken string) IdentityApiListIdentitySessionsRequest { r.pageToken = &pageToken return r } -func (r IdentityApiApiListIdentitySessionsRequest) Active(active bool) IdentityApiApiListIdentitySessionsRequest { + +// Active is a boolean flag that filters out sessions based on the state. If no value is provided, all sessions are returned. +func (r IdentityApiListIdentitySessionsRequest) Active(active bool) IdentityApiListIdentitySessionsRequest { r.active = &active return r } -func (r IdentityApiApiListIdentitySessionsRequest) Execute() ([]Session, *http.Response, error) { +func (r IdentityApiListIdentitySessionsRequest) Execute() ([]Session, *http.Response, error) { return r.ApiService.ListIdentitySessionsExecute(r) } /* - * ListIdentitySessions List an Identity's Sessions - * This endpoint returns all sessions that belong to the given Identity. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id ID is the identity's ID. - * @return IdentityApiApiListIdentitySessionsRequest - */ -func (a *IdentityApiService) ListIdentitySessions(ctx context.Context, id string) IdentityApiApiListIdentitySessionsRequest { - return IdentityApiApiListIdentitySessionsRequest{ +ListIdentitySessions List an Identity's Sessions + +This endpoint returns all sessions that belong to the given Identity. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID is the identity's ID. + @return IdentityApiListIdentitySessionsRequest +*/ +func (a *IdentityApiService) ListIdentitySessions(ctx context.Context, id string) IdentityApiListIdentitySessionsRequest { + return IdentityApiListIdentitySessionsRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return []Session - */ -func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIdentitySessionsRequest) ([]Session, *http.Response, error) { +// Execute executes the request +// +// @return []Session +func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiListIdentitySessionsRequest) ([]Session, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []Session + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Session ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.ListIdentitySessions") @@ -2459,26 +2513,35 @@ func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIde } localVarPath := localBasePath + "/admin/identities/{id}/sessions" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.perPage != nil { - localVarQueryParams.Add("per_page", parameterToString(*r.perPage, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } else { + var defaultValue int64 = 250 + r.perPage = &defaultValue } if r.page != nil { - localVarQueryParams.Add("page", parameterToString(*r.page, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") } if r.pageSize != nil { - localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "") + } else { + var defaultValue int64 = 250 + r.pageSize = &defaultValue } if r.pageToken != nil { - localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "") + } else { + var defaultValue string = "1" + r.pageToken = &defaultValue } if r.active != nil { - localVarQueryParams.Add("active", parameterToString(*r.active, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "active", r.active, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2511,7 +2574,7 @@ func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIde } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2540,6 +2603,7 @@ func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIde newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2550,6 +2614,7 @@ func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIde newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2559,6 +2624,7 @@ func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIde newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2575,7 +2641,7 @@ func (a *IdentityApiService) ListIdentitySessionsExecute(r IdentityApiApiListIde return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiListSessionsRequest struct { +type IdentityApiListSessionsRequest struct { ctx context.Context ApiService IdentityApi pageSize *int64 @@ -2584,52 +2650,58 @@ type IdentityApiApiListSessionsRequest struct { expand *[]string } -func (r IdentityApiApiListSessionsRequest) PageSize(pageSize int64) IdentityApiApiListSessionsRequest { +// Items per Page This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListSessionsRequest) PageSize(pageSize int64) IdentityApiListSessionsRequest { r.pageSize = &pageSize return r } -func (r IdentityApiApiListSessionsRequest) PageToken(pageToken string) IdentityApiApiListSessionsRequest { + +// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). +func (r IdentityApiListSessionsRequest) PageToken(pageToken string) IdentityApiListSessionsRequest { r.pageToken = &pageToken return r } -func (r IdentityApiApiListSessionsRequest) Active(active bool) IdentityApiApiListSessionsRequest { + +// Active is a boolean flag that filters out sessions based on the state. If no value is provided, all sessions are returned. +func (r IdentityApiListSessionsRequest) Active(active bool) IdentityApiListSessionsRequest { r.active = &active return r } -func (r IdentityApiApiListSessionsRequest) Expand(expand []string) IdentityApiApiListSessionsRequest { + +// ExpandOptions is a query parameter encoded list of all properties that must be expanded in the Session. If no value is provided, the expandable properties are skipped. +func (r IdentityApiListSessionsRequest) Expand(expand []string) IdentityApiListSessionsRequest { r.expand = &expand return r } -func (r IdentityApiApiListSessionsRequest) Execute() ([]Session, *http.Response, error) { +func (r IdentityApiListSessionsRequest) Execute() ([]Session, *http.Response, error) { return r.ApiService.ListSessionsExecute(r) } /* - * ListSessions List All Sessions - * Listing all sessions that exist. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return IdentityApiApiListSessionsRequest - */ -func (a *IdentityApiService) ListSessions(ctx context.Context) IdentityApiApiListSessionsRequest { - return IdentityApiApiListSessionsRequest{ +ListSessions List All Sessions + +Listing all sessions that exist. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return IdentityApiListSessionsRequest +*/ +func (a *IdentityApiService) ListSessions(ctx context.Context) IdentityApiListSessionsRequest { + return IdentityApiListSessionsRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return []Session - */ -func (a *IdentityApiService) ListSessionsExecute(r IdentityApiApiListSessionsRequest) ([]Session, *http.Response, error) { +// Execute executes the request +// +// @return []Session +func (a *IdentityApiService) ListSessionsExecute(r IdentityApiListSessionsRequest) ([]Session, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []Session + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Session ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.ListSessions") @@ -2644,23 +2716,26 @@ func (a *IdentityApiService) ListSessionsExecute(r IdentityApiApiListSessionsReq localVarFormParams := url.Values{} if r.pageSize != nil { - localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "") + } else { + var defaultValue int64 = 250 + r.pageSize = &defaultValue } if r.pageToken != nil { - localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "") } if r.active != nil { - localVarQueryParams.Add("active", parameterToString(*r.active, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "active", r.active, "") } if r.expand != nil { t := *r.expand if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("expand", parameterToString(s.Index(i), "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "expand", s.Index(i).Interface(), "multi") } } else { - localVarQueryParams.Add("expand", parameterToString(t, "multi")) + parameterAddToHeaderOrQuery(localVarQueryParams, "expand", t, "multi") } } // to determine the Content-Type header @@ -2694,7 +2769,7 @@ func (a *IdentityApiService) ListSessionsExecute(r IdentityApiApiListSessionsReq } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2723,6 +2798,7 @@ func (a *IdentityApiService) ListSessionsExecute(r IdentityApiApiListSessionsReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2732,6 +2808,7 @@ func (a *IdentityApiService) ListSessionsExecute(r IdentityApiApiListSessionsReq newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2748,51 +2825,49 @@ func (a *IdentityApiService) ListSessionsExecute(r IdentityApiApiListSessionsReq return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiPatchIdentityRequest struct { +type IdentityApiPatchIdentityRequest struct { ctx context.Context ApiService IdentityApi id string jsonPatch *[]JsonPatch } -func (r IdentityApiApiPatchIdentityRequest) JsonPatch(jsonPatch []JsonPatch) IdentityApiApiPatchIdentityRequest { +func (r IdentityApiPatchIdentityRequest) JsonPatch(jsonPatch []JsonPatch) IdentityApiPatchIdentityRequest { r.jsonPatch = &jsonPatch return r } -func (r IdentityApiApiPatchIdentityRequest) Execute() (*Identity, *http.Response, error) { +func (r IdentityApiPatchIdentityRequest) Execute() (*Identity, *http.Response, error) { return r.ApiService.PatchIdentityExecute(r) } /* - - PatchIdentity Patch an Identity - - Partially updates an [identity's](https://www.ory.sh/docs/kratos/concepts/identity-user-model) field using [JSON Patch](https://jsonpatch.com/). +PatchIdentity Patch an Identity +Partially updates an [identity's](https://www.ory.sh/docs/kratos/concepts/identity-user-model) field using [JSON Patch](https://jsonpatch.com/). The fields `id`, `stateChangedAt` and `credentials` can not be updated using this method. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID must be set to the ID of identity you want to update - - @return IdentityApiApiPatchIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of identity you want to update + @return IdentityApiPatchIdentityRequest */ -func (a *IdentityApiService) PatchIdentity(ctx context.Context, id string) IdentityApiApiPatchIdentityRequest { - return IdentityApiApiPatchIdentityRequest{ +func (a *IdentityApiService) PatchIdentity(ctx context.Context, id string) IdentityApiPatchIdentityRequest { + return IdentityApiPatchIdentityRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return Identity - */ -func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityRequest) (*Identity, *http.Response, error) { +// Execute executes the request +// +// @return Identity +func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiPatchIdentityRequest) (*Identity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPatch - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Identity + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Identity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.PatchIdentity") @@ -2801,7 +2876,7 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR } localVarPath := localBasePath + "/admin/identities/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2840,7 +2915,7 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -2869,6 +2944,7 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2879,6 +2955,7 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2889,6 +2966,7 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2898,6 +2976,7 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2914,51 +2993,49 @@ func (a *IdentityApiService) PatchIdentityExecute(r IdentityApiApiPatchIdentityR return localVarReturnValue, localVarHTTPResponse, nil } -type IdentityApiApiUpdateIdentityRequest struct { +type IdentityApiUpdateIdentityRequest struct { ctx context.Context ApiService IdentityApi id string updateIdentityBody *UpdateIdentityBody } -func (r IdentityApiApiUpdateIdentityRequest) UpdateIdentityBody(updateIdentityBody UpdateIdentityBody) IdentityApiApiUpdateIdentityRequest { +func (r IdentityApiUpdateIdentityRequest) UpdateIdentityBody(updateIdentityBody UpdateIdentityBody) IdentityApiUpdateIdentityRequest { r.updateIdentityBody = &updateIdentityBody return r } -func (r IdentityApiApiUpdateIdentityRequest) Execute() (*Identity, *http.Response, error) { +func (r IdentityApiUpdateIdentityRequest) Execute() (*Identity, *http.Response, error) { return r.ApiService.UpdateIdentityExecute(r) } /* - - UpdateIdentity Update an Identity - - This endpoint updates an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). The full identity +UpdateIdentity Update an Identity +This endpoint updates an [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model). The full identity payload (except credentials) is expected. It is possible to update the identity's credentials as well. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param id ID must be set to the ID of identity you want to update - - @return IdentityApiApiUpdateIdentityRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ID must be set to the ID of identity you want to update + @return IdentityApiUpdateIdentityRequest */ -func (a *IdentityApiService) UpdateIdentity(ctx context.Context, id string) IdentityApiApiUpdateIdentityRequest { - return IdentityApiApiUpdateIdentityRequest{ +func (a *IdentityApiService) UpdateIdentity(ctx context.Context, id string) IdentityApiUpdateIdentityRequest { + return IdentityApiUpdateIdentityRequest{ ApiService: a, ctx: ctx, id: id, } } -/* - * Execute executes the request - * @return Identity - */ -func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentityRequest) (*Identity, *http.Response, error) { +// Execute executes the request +// +// @return Identity +func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiUpdateIdentityRequest) (*Identity, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPut - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *Identity + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Identity ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IdentityApiService.UpdateIdentity") @@ -2967,7 +3044,7 @@ func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentit } localVarPath := localBasePath + "/admin/identities/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -3006,7 +3083,7 @@ func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentit } } } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -3035,6 +3112,7 @@ func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3045,6 +3123,7 @@ func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3055,6 +3134,7 @@ func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3064,6 +3144,7 @@ func (a *IdentityApiService) UpdateIdentityExecute(r IdentityApiApiUpdateIdentit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/internal/httpclient/api_metadata.go b/internal/httpclient/api_metadata.go index 0ea297189e2f..59d7f9bae818 100644 --- a/internal/httpclient/api_metadata.go +++ b/internal/httpclient/api_metadata.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,36 +19,32 @@ import ( "net/url" ) -// Linger please -var ( - _ context.Context -) - type MetadataApi interface { /* - * GetVersion Return Running Software Version. - * This endpoint returns the version of Ory Kratos. + GetVersion Return Running Software Version. + + This endpoint returns the version of Ory Kratos. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the version will never refer to the cluster state, only to a single instance. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return MetadataApiApiGetVersionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MetadataApiGetVersionRequest */ - GetVersion(ctx context.Context) MetadataApiApiGetVersionRequest + GetVersion(ctx context.Context) MetadataApiGetVersionRequest - /* - * GetVersionExecute executes the request - * @return GetVersion200Response - */ - GetVersionExecute(r MetadataApiApiGetVersionRequest) (*GetVersion200Response, *http.Response, error) + // GetVersionExecute executes the request + // @return GetVersion200Response + GetVersionExecute(r MetadataApiGetVersionRequest) (*GetVersion200Response, *http.Response, error) /* - * IsAlive Check HTTP Server Status - * This endpoint returns a HTTP 200 status code when Ory Kratos is accepting incoming + IsAlive Check HTTP Server Status + + This endpoint returns a HTTP 200 status code when Ory Kratos is accepting incoming HTTP requests. This status does currently not include checks whether the database connection is working. If the service supports TLS Edge Termination, this endpoint does not require the @@ -56,20 +52,20 @@ type MetadataApi interface { Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return MetadataApiApiIsAliveRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MetadataApiIsAliveRequest */ - IsAlive(ctx context.Context) MetadataApiApiIsAliveRequest + IsAlive(ctx context.Context) MetadataApiIsAliveRequest - /* - * IsAliveExecute executes the request - * @return IsAlive200Response - */ - IsAliveExecute(r MetadataApiApiIsAliveRequest) (*IsAlive200Response, *http.Response, error) + // IsAliveExecute executes the request + // @return IsAlive200Response + IsAliveExecute(r MetadataApiIsAliveRequest) (*IsAlive200Response, *http.Response, error) /* - * IsReady Check HTTP Server and Database Status - * This endpoint returns a HTTP 200 status code when Ory Kratos is up running and the environment dependencies (e.g. + IsReady Check HTTP Server and Database Status + + This endpoint returns a HTTP 200 status code when Ory Kratos is up running and the environment dependencies (e.g. the database) are responsive as well. If the service supports TLS Edge Termination, this endpoint does not require the @@ -77,61 +73,59 @@ type MetadataApi interface { Be aware that if you are running multiple nodes of Ory Kratos, the health status will never refer to the cluster state, only to a single instance. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return MetadataApiApiIsReadyRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MetadataApiIsReadyRequest */ - IsReady(ctx context.Context) MetadataApiApiIsReadyRequest + IsReady(ctx context.Context) MetadataApiIsReadyRequest - /* - * IsReadyExecute executes the request - * @return IsAlive200Response - */ - IsReadyExecute(r MetadataApiApiIsReadyRequest) (*IsAlive200Response, *http.Response, error) + // IsReadyExecute executes the request + // @return IsAlive200Response + IsReadyExecute(r MetadataApiIsReadyRequest) (*IsAlive200Response, *http.Response, error) } // MetadataApiService MetadataApi service type MetadataApiService service -type MetadataApiApiGetVersionRequest struct { +type MetadataApiGetVersionRequest struct { ctx context.Context ApiService MetadataApi } -func (r MetadataApiApiGetVersionRequest) Execute() (*GetVersion200Response, *http.Response, error) { +func (r MetadataApiGetVersionRequest) Execute() (*GetVersion200Response, *http.Response, error) { return r.ApiService.GetVersionExecute(r) } /* - - GetVersion Return Running Software Version. - - This endpoint returns the version of Ory Kratos. +GetVersion Return Running Software Version. + +This endpoint returns the version of Ory Kratos. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the version will never refer to the cluster state, only to a single instance. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return MetadataApiApiGetVersionRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MetadataApiGetVersionRequest */ -func (a *MetadataApiService) GetVersion(ctx context.Context) MetadataApiApiGetVersionRequest { - return MetadataApiApiGetVersionRequest{ +func (a *MetadataApiService) GetVersion(ctx context.Context) MetadataApiGetVersionRequest { + return MetadataApiGetVersionRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return GetVersion200Response - */ -func (a *MetadataApiService) GetVersionExecute(r MetadataApiApiGetVersionRequest) (*GetVersion200Response, *http.Response, error) { +// Execute executes the request +// +// @return GetVersion200Response +func (a *MetadataApiService) GetVersionExecute(r MetadataApiGetVersionRequest) (*GetVersion200Response, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *GetVersion200Response + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetVersion200Response ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetadataApiService.GetVersion") @@ -162,7 +156,7 @@ func (a *MetadataApiService) GetVersionExecute(r MetadataApiApiGetVersionRequest if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -199,19 +193,19 @@ func (a *MetadataApiService) GetVersionExecute(r MetadataApiApiGetVersionRequest return localVarReturnValue, localVarHTTPResponse, nil } -type MetadataApiApiIsAliveRequest struct { +type MetadataApiIsAliveRequest struct { ctx context.Context ApiService MetadataApi } -func (r MetadataApiApiIsAliveRequest) Execute() (*IsAlive200Response, *http.Response, error) { +func (r MetadataApiIsAliveRequest) Execute() (*IsAlive200Response, *http.Response, error) { return r.ApiService.IsAliveExecute(r) } /* - - IsAlive Check HTTP Server Status - - This endpoint returns a HTTP 200 status code when Ory Kratos is accepting incoming +IsAlive Check HTTP Server Status +This endpoint returns a HTTP 200 status code when Ory Kratos is accepting incoming HTTP requests. This status does currently not include checks whether the database connection is working. If the service supports TLS Edge Termination, this endpoint does not require the @@ -219,28 +213,26 @@ If the service supports TLS Edge Termination, this endpoint does not require the Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return MetadataApiApiIsAliveRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MetadataApiIsAliveRequest */ -func (a *MetadataApiService) IsAlive(ctx context.Context) MetadataApiApiIsAliveRequest { - return MetadataApiApiIsAliveRequest{ +func (a *MetadataApiService) IsAlive(ctx context.Context) MetadataApiIsAliveRequest { + return MetadataApiIsAliveRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return IsAlive200Response - */ -func (a *MetadataApiService) IsAliveExecute(r MetadataApiApiIsAliveRequest) (*IsAlive200Response, *http.Response, error) { +// Execute executes the request +// +// @return IsAlive200Response +func (a *MetadataApiService) IsAliveExecute(r MetadataApiIsAliveRequest) (*IsAlive200Response, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *IsAlive200Response + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IsAlive200Response ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetadataApiService.IsAlive") @@ -271,7 +263,7 @@ func (a *MetadataApiService) IsAliveExecute(r MetadataApiApiIsAliveRequest) (*Is if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -299,6 +291,7 @@ func (a *MetadataApiService) IsAliveExecute(r MetadataApiApiIsAliveRequest) (*Is newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -315,19 +308,19 @@ func (a *MetadataApiService) IsAliveExecute(r MetadataApiApiIsAliveRequest) (*Is return localVarReturnValue, localVarHTTPResponse, nil } -type MetadataApiApiIsReadyRequest struct { +type MetadataApiIsReadyRequest struct { ctx context.Context ApiService MetadataApi } -func (r MetadataApiApiIsReadyRequest) Execute() (*IsAlive200Response, *http.Response, error) { +func (r MetadataApiIsReadyRequest) Execute() (*IsAlive200Response, *http.Response, error) { return r.ApiService.IsReadyExecute(r) } /* - - IsReady Check HTTP Server and Database Status - - This endpoint returns a HTTP 200 status code when Ory Kratos is up running and the environment dependencies (e.g. +IsReady Check HTTP Server and Database Status +This endpoint returns a HTTP 200 status code when Ory Kratos is up running and the environment dependencies (e.g. the database) are responsive as well. If the service supports TLS Edge Termination, this endpoint does not require the @@ -335,28 +328,26 @@ If the service supports TLS Edge Termination, this endpoint does not require the Be aware that if you are running multiple nodes of Ory Kratos, the health status will never refer to the cluster state, only to a single instance. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @return MetadataApiApiIsReadyRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MetadataApiIsReadyRequest */ -func (a *MetadataApiService) IsReady(ctx context.Context) MetadataApiApiIsReadyRequest { - return MetadataApiApiIsReadyRequest{ +func (a *MetadataApiService) IsReady(ctx context.Context) MetadataApiIsReadyRequest { + return MetadataApiIsReadyRequest{ ApiService: a, ctx: ctx, } } -/* - * Execute executes the request - * @return IsAlive200Response - */ -func (a *MetadataApiService) IsReadyExecute(r MetadataApiApiIsReadyRequest) (*IsAlive200Response, *http.Response, error) { +// Execute executes the request +// +// @return IsAlive200Response +func (a *MetadataApiService) IsReadyExecute(r MetadataApiIsReadyRequest) (*IsAlive200Response, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *IsAlive200Response + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IsAlive200Response ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetadataApiService.IsReady") @@ -387,7 +378,7 @@ func (a *MetadataApiService) IsReadyExecute(r MetadataApiApiIsReadyRequest) (*Is if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err } @@ -416,6 +407,7 @@ func (a *MetadataApiService) IsReadyExecute(r MetadataApiApiIsReadyRequest) (*Is newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -425,6 +417,7 @@ func (a *MetadataApiService) IsReadyExecute(r MetadataApiApiIsReadyRequest) (*Is newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/internal/httpclient/client.go b/internal/httpclient/client.go index 949a0e51ab35..f6fb9804269f 100644 --- a/internal/httpclient/client.go +++ b/internal/httpclient/client.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -32,13 +32,13 @@ import ( "strings" "time" "unicode/utf8" - - "golang.org/x/oauth2" ) var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) - xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") ) // APIClient manages communication with the Ory Identities API API v @@ -110,10 +110,10 @@ func selectHeaderAccept(accepts []string) string { return strings.Join(accepts, ",") } -// contains is a case insenstive match, finding needle in a haystack +// contains is a case insensitive match, finding needle in a haystack func contains(haystack []string, needle string) bool { for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { + if strings.EqualFold(a, needle) { return true } } @@ -129,33 +129,111 @@ func typeCheckParameter(obj interface{}, expected string, name string) error { // Check the type is as expected. if reflect.TypeOf(obj).String() != expected { - return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) } return nil } -// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. -func parameterToString(obj interface{}, collectionFormat string) string { - var delimiter string - - switch collectionFormat { - case "pipes": - delimiter = "|" - case "ssv": - delimiter = " " - case "tsv": - delimiter = "\t" - case "csv": - delimiter = "," +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return - if reflect.TypeOf(obj).Kind() == reflect.Slice { - return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") - } else if t, ok := obj.(time.Time); ok { - return t.Format(time.RFC3339) + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } } - return fmt.Sprintf("%v", obj) + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } } // helper for converting interface{} parameters to json strings @@ -198,6 +276,12 @@ func (c *APIClient) GetConfig() *Configuration { return c.cfg } +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + // prepareRequest build the request func (c *APIClient) prepareRequest( ctx context.Context, @@ -206,9 +290,7 @@ func (c *APIClient) prepareRequest( headerParams map[string]string, queryParams url.Values, formParams url.Values, - formFileName string, - fileName string, - fileBytes []byte) (localVarRequest *http.Request, err error) { + formFiles []formFile) (localVarRequest *http.Request, err error) { var body *bytes.Buffer @@ -227,7 +309,7 @@ func (c *APIClient) prepareRequest( } // add form parameters and file if available. - if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { if body != nil { return nil, errors.New("Cannot specify postBody and multipart form at the same time.") } @@ -246,16 +328,17 @@ func (c *APIClient) prepareRequest( } } } - if len(fileBytes) > 0 && fileName != "" { - w.Boundary() - //_, fileNm := filepath.Split(fileName) - part, err := w.CreateFormFile(formFileName, filepath.Base(fileName)) - if err != nil { - return nil, err - } - _, err = part.Write(fileBytes) - if err != nil { - return nil, err + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } } } @@ -302,7 +385,11 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = query.Encode() + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) // Generate a new request if body != nil { @@ -318,7 +405,7 @@ func (c *APIClient) prepareRequest( if len(headerParams) > 0 { headers := http.Header{} for h, v := range headerParams { - headers.Set(h, v) + headers[h] = []string{v} } localVarRequest.Header = headers } @@ -332,27 +419,6 @@ func (c *APIClient) prepareRequest( // Walk through any authentication. - // OAuth2 authentication - if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { - // We were able to grab an oauth2 token from the context - var latestToken *oauth2.Token - if latestToken, err = tok.Token(); err != nil { - return nil, err - } - - latestToken.SetAuthHeader(localVarRequest) - } - - // Basic HTTP Authentication - if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { - localVarRequest.SetBasicAuth(auth.UserName, auth.Password) - } - - // AccessToken Authentication - if auth, ok := ctx.Value(ContextAccessToken).(string); ok { - localVarRequest.Header.Add("Authorization", "Bearer "+auth) - } - } for header, value := range c.cfg.DefaultHeader { @@ -369,13 +435,37 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err *s = string(b) return nil } - if xmlCheck.MatchString(contentType) { + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { if err = xml.Unmarshal(b, v); err != nil { return err } return nil } - if jsonCheck.MatchString(contentType) { + if JsonCheck.MatchString(contentType) { if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined if err = unmarshalObj.UnmarshalJSON(b); err != nil { @@ -394,11 +484,14 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err // Add a file to the multipart request func addFile(w *multipart.Writer, fieldName, path string) error { - file, err := os.Open(path) + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() if err != nil { return err } - defer file.Close() part, err := w.CreateFormFile(fieldName, filepath.Base(path)) if err != nil { @@ -414,7 +507,7 @@ func reportError(format string, a ...interface{}) error { return fmt.Errorf(format, a...) } -// Prevent trying to import "bytes" +// A wrapper for strict JSON decoding func newStrictDecoder(data []byte) *json.Decoder { dec := json.NewDecoder(bytes.NewBuffer(data)) dec.DisallowUnknownFields() @@ -429,16 +522,22 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e if reader, ok := body.(io.Reader); ok { _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) } else if b, ok := body.([]byte); ok { _, err = bodyBuf.Write(b) } else if s, ok := body.(string); ok { _, err = bodyBuf.WriteString(s) } else if s, ok := body.(*string); ok { _, err = bodyBuf.WriteString(*s) - } else if jsonCheck.MatchString(contentType) { + } else if JsonCheck.MatchString(contentType) { err = json.NewEncoder(bodyBuf).Encode(body) - } else if xmlCheck.MatchString(contentType) { - err = xml.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } } if err != nil { @@ -446,7 +545,7 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e } if bodyBuf.Len() == 0 { - err = fmt.Errorf("Invalid body type %s\n", contentType) + err = fmt.Errorf("invalid body type %s\n", contentType) return nil, err } return bodyBuf, nil @@ -548,3 +647,23 @@ func (e GenericOpenAPIError) Body() []byte { func (e GenericOpenAPIError) Model() interface{} { return e.model } + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/internal/httpclient/configuration.go b/internal/httpclient/configuration.go index 4c5de2bb48b3..c383daa24694 100644 --- a/internal/httpclient/configuration.go +++ b/internal/httpclient/configuration.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -29,21 +29,9 @@ func (c contextKey) String() string { } var ( - // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. - ContextOAuth2 = contextKey("token") - - // ContextBasicAuth takes BasicAuth as authentication for the request. - ContextBasicAuth = contextKey("basic") - - // ContextAccessToken takes a string oauth2 access token as authentication for the request. - ContextAccessToken = contextKey("accesstoken") - // ContextAPIKeys takes a string apikey as authentication for the request ContextAPIKeys = contextKey("apiKeys") - // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. - ContextHttpSignatureAuth = contextKey("httpsignature") - // ContextServerIndex uses a server configuration from the index. ContextServerIndex = contextKey("serverIndex") @@ -123,7 +111,7 @@ func (c *Configuration) AddDefaultHeader(key string, value string) { // URL formats template on a index using given variables func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { if index < 0 || len(sc) <= index { - return "", fmt.Errorf("Index %v out of range %v", index, len(sc)-1) + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) } server := sc[index] url := server.URL @@ -138,7 +126,7 @@ func (sc ServerConfigurations) URL(index int, variables map[string]string) (stri } } if !found { - return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) } url = strings.Replace(url, "{"+name+"}", value, -1) } else { diff --git a/internal/httpclient/git_push.sh b/internal/httpclient/git_push.sh index ba5bdb84d95d..b036751d4a18 100644 --- a/internal/httpclient/git_push.sh +++ b/internal/httpclient/git_push.sh @@ -1,7 +1,7 @@ #!/bin/sh # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 @@ -38,14 +38,14 @@ git add . git commit -m "$release_note" # Sets the new remote -git_remote=`git remote` +git_remote=$(git remote) if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git fi fi @@ -55,4 +55,3 @@ git pull origin master # Pushes (Forces) the changes in the local repository up to the remote repository echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https' - diff --git a/internal/httpclient/model_authenticator_assurance_level.go b/internal/httpclient/model_authenticator_assurance_level.go index e6def4dfe3d8..08e0714cf5f0 100644 --- a/internal/httpclient/model_authenticator_assurance_level.go +++ b/internal/httpclient/model_authenticator_assurance_level.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -27,6 +27,14 @@ const ( AUTHENTICATORASSURANCELEVEL_AAL3 AuthenticatorAssuranceLevel = "aal3" ) +// All allowed values of AuthenticatorAssuranceLevel enum +var AllowedAuthenticatorAssuranceLevelEnumValues = []AuthenticatorAssuranceLevel{ + "aal0", + "aal1", + "aal2", + "aal3", +} + func (v *AuthenticatorAssuranceLevel) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -34,7 +42,7 @@ func (v *AuthenticatorAssuranceLevel) UnmarshalJSON(src []byte) error { return err } enumTypeValue := AuthenticatorAssuranceLevel(value) - for _, existing := range []AuthenticatorAssuranceLevel{"aal0", "aal1", "aal2", "aal3"} { + for _, existing := range AllowedAuthenticatorAssuranceLevelEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -44,6 +52,27 @@ func (v *AuthenticatorAssuranceLevel) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid AuthenticatorAssuranceLevel", value) } +// NewAuthenticatorAssuranceLevelFromValue returns a pointer to a valid AuthenticatorAssuranceLevel +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewAuthenticatorAssuranceLevelFromValue(v string) (*AuthenticatorAssuranceLevel, error) { + ev := AuthenticatorAssuranceLevel(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for AuthenticatorAssuranceLevel: valid values are %v", v, AllowedAuthenticatorAssuranceLevelEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v AuthenticatorAssuranceLevel) IsValid() bool { + for _, existing := range AllowedAuthenticatorAssuranceLevelEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to authenticatorAssuranceLevel value func (v AuthenticatorAssuranceLevel) Ptr() *AuthenticatorAssuranceLevel { return &v diff --git a/internal/httpclient/model_batch_patch_identities_response.go b/internal/httpclient/model_batch_patch_identities_response.go index 4ddeea9f7898..abf475d9e771 100644 --- a/internal/httpclient/model_batch_patch_identities_response.go +++ b/internal/httpclient/model_batch_patch_identities_response.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the BatchPatchIdentitiesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BatchPatchIdentitiesResponse{} + // BatchPatchIdentitiesResponse Patch identities response type BatchPatchIdentitiesResponse struct { // The patch responses for the individual identities. @@ -40,7 +43,7 @@ func NewBatchPatchIdentitiesResponseWithDefaults() *BatchPatchIdentitiesResponse // GetIdentities returns the Identities field value if set, zero value otherwise. func (o *BatchPatchIdentitiesResponse) GetIdentities() []IdentityPatchResponse { - if o == nil || o.Identities == nil { + if o == nil || IsNil(o.Identities) { var ret []IdentityPatchResponse return ret } @@ -50,7 +53,7 @@ func (o *BatchPatchIdentitiesResponse) GetIdentities() []IdentityPatchResponse { // GetIdentitiesOk returns a tuple with the Identities field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BatchPatchIdentitiesResponse) GetIdentitiesOk() ([]IdentityPatchResponse, bool) { - if o == nil || o.Identities == nil { + if o == nil || IsNil(o.Identities) { return nil, false } return o.Identities, true @@ -58,7 +61,7 @@ func (o *BatchPatchIdentitiesResponse) GetIdentitiesOk() ([]IdentityPatchRespons // HasIdentities returns a boolean if a field has been set. func (o *BatchPatchIdentitiesResponse) HasIdentities() bool { - if o != nil && o.Identities != nil { + if o != nil && !IsNil(o.Identities) { return true } @@ -71,11 +74,19 @@ func (o *BatchPatchIdentitiesResponse) SetIdentities(v []IdentityPatchResponse) } func (o BatchPatchIdentitiesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BatchPatchIdentitiesResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Identities != nil { + if !IsNil(o.Identities) { toSerialize["identities"] = o.Identities } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableBatchPatchIdentitiesResponse struct { diff --git a/internal/httpclient/model_consistency_request_parameters.go b/internal/httpclient/model_consistency_request_parameters.go index 6c48a4d6bb47..c625e83f3b04 100644 --- a/internal/httpclient/model_consistency_request_parameters.go +++ b/internal/httpclient/model_consistency_request_parameters.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the ConsistencyRequestParameters type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConsistencyRequestParameters{} + // ConsistencyRequestParameters Control API consistency guarantees type ConsistencyRequestParameters struct { // Read Consistency Level (preview) The read consistency level determines the consistency guarantee for reads: strong (slow): The read is guaranteed to return the most recent data committed at the start of the read. eventual (very fast): The result will return data that is about 4.8 seconds old. The default consistency guarantee can be changed in the Ory Network Console or using the Ory CLI with `ory patch project --replace '/previews/default_read_consistency_level=\"strong\"'`. Setting the default consistency level to `eventual` may cause regressions in the future as we add consistency controls to more APIs. Currently, the following APIs will be affected by this setting: `GET /admin/identities` This feature is in preview and only available in Ory Network. ConsistencyLevelUnset ConsistencyLevelUnset is the unset / default consistency level. strong ConsistencyLevelStrong ConsistencyLevelStrong is the strong consistency level. eventual ConsistencyLevelEventual ConsistencyLevelEventual is the eventual consistency level using follower read timestamps. @@ -40,7 +43,7 @@ func NewConsistencyRequestParametersWithDefaults() *ConsistencyRequestParameters // GetConsistency returns the Consistency field value if set, zero value otherwise. func (o *ConsistencyRequestParameters) GetConsistency() string { - if o == nil || o.Consistency == nil { + if o == nil || IsNil(o.Consistency) { var ret string return ret } @@ -50,7 +53,7 @@ func (o *ConsistencyRequestParameters) GetConsistency() string { // GetConsistencyOk returns a tuple with the Consistency field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ConsistencyRequestParameters) GetConsistencyOk() (*string, bool) { - if o == nil || o.Consistency == nil { + if o == nil || IsNil(o.Consistency) { return nil, false } return o.Consistency, true @@ -58,7 +61,7 @@ func (o *ConsistencyRequestParameters) GetConsistencyOk() (*string, bool) { // HasConsistency returns a boolean if a field has been set. func (o *ConsistencyRequestParameters) HasConsistency() bool { - if o != nil && o.Consistency != nil { + if o != nil && !IsNil(o.Consistency) { return true } @@ -71,11 +74,19 @@ func (o *ConsistencyRequestParameters) SetConsistency(v string) { } func (o ConsistencyRequestParameters) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConsistencyRequestParameters) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Consistency != nil { + if !IsNil(o.Consistency) { toSerialize["consistency"] = o.Consistency } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableConsistencyRequestParameters struct { diff --git a/internal/httpclient/model_continue_with.go b/internal/httpclient/model_continue_with.go index a81558a8d53d..f588824f0734 100644 --- a/internal/httpclient/model_continue_with.go +++ b/internal/httpclient/model_continue_with.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -31,7 +31,7 @@ func (dst *ContinueWith) UnmarshalJSON(data []byte) error { var jsonDict map[string]interface{} err = json.Unmarshal(data, &jsonDict) if err != nil { - return fmt.Errorf("Failed to unmarshal JSON into map for the discrimintor lookup.") + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") } // check if the discriminator value is 'set_ory_session_token' @@ -214,7 +214,7 @@ func (dst *ContinueWith) UnmarshalJSON(data []byte) error { dst.ContinueWithVerificationUi = nil } - return fmt.Errorf("Data failed to match schemas in anyOf(ContinueWith)") + return fmt.Errorf("data failed to match schemas in anyOf(ContinueWith)") } // Marshal data from the first non-nil pointers in the struct to JSON diff --git a/internal/httpclient/model_continue_with_recovery_ui.go b/internal/httpclient/model_continue_with_recovery_ui.go index 808b5c63156a..a7423e60a72c 100644 --- a/internal/httpclient/model_continue_with_recovery_ui.go +++ b/internal/httpclient/model_continue_with_recovery_ui.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithRecoveryUi type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithRecoveryUi{} + // ContinueWithRecoveryUi Indicates, that the UI flow could be continued by showing a recovery ui type ContinueWithRecoveryUi struct { // Action will always be `show_recovery_ui` set_ory_session_token ContinueWithActionSetOrySessionTokenString show_verification_ui ContinueWithActionShowVerificationUIString show_settings_ui ContinueWithActionShowSettingsUIString show_recovery_ui ContinueWithActionShowRecoveryUIString @@ -22,6 +27,8 @@ type ContinueWithRecoveryUi struct { Flow *ContinueWithRecoveryUiFlow `json:"flow,omitempty"` } +type _ContinueWithRecoveryUi ContinueWithRecoveryUi + // NewContinueWithRecoveryUi instantiates a new ContinueWithRecoveryUi object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -66,7 +73,7 @@ func (o *ContinueWithRecoveryUi) SetAction(v string) { // GetFlow returns the Flow field value if set, zero value otherwise. func (o *ContinueWithRecoveryUi) GetFlow() ContinueWithRecoveryUiFlow { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { var ret ContinueWithRecoveryUiFlow return ret } @@ -76,7 +83,7 @@ func (o *ContinueWithRecoveryUi) GetFlow() ContinueWithRecoveryUiFlow { // GetFlowOk returns a tuple with the Flow field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ContinueWithRecoveryUi) GetFlowOk() (*ContinueWithRecoveryUiFlow, bool) { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { return nil, false } return o.Flow, true @@ -84,7 +91,7 @@ func (o *ContinueWithRecoveryUi) GetFlowOk() (*ContinueWithRecoveryUiFlow, bool) // HasFlow returns a boolean if a field has been set. func (o *ContinueWithRecoveryUi) HasFlow() bool { - if o != nil && o.Flow != nil { + if o != nil && !IsNil(o.Flow) { return true } @@ -97,14 +104,57 @@ func (o *ContinueWithRecoveryUi) SetFlow(v ContinueWithRecoveryUiFlow) { } func (o ContinueWithRecoveryUi) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["action"] = o.Action + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Flow != nil { + return json.Marshal(toSerialize) +} + +func (o ContinueWithRecoveryUi) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["action"] = o.Action + if !IsNil(o.Flow) { toSerialize["flow"] = o.Flow } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *ContinueWithRecoveryUi) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "action", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithRecoveryUi := _ContinueWithRecoveryUi{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithRecoveryUi) + + if err != nil { + return err + } + + *o = ContinueWithRecoveryUi(varContinueWithRecoveryUi) + + return err } type NullableContinueWithRecoveryUi struct { diff --git a/internal/httpclient/model_continue_with_recovery_ui_flow.go b/internal/httpclient/model_continue_with_recovery_ui_flow.go index 3fde7e717ef2..e7852dd053fe 100644 --- a/internal/httpclient/model_continue_with_recovery_ui_flow.go +++ b/internal/httpclient/model_continue_with_recovery_ui_flow.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithRecoveryUiFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithRecoveryUiFlow{} + // ContinueWithRecoveryUiFlow struct for ContinueWithRecoveryUiFlow type ContinueWithRecoveryUiFlow struct { // The ID of the recovery flow @@ -23,6 +28,8 @@ type ContinueWithRecoveryUiFlow struct { Url *string `json:"url,omitempty"` } +type _ContinueWithRecoveryUiFlow ContinueWithRecoveryUiFlow + // NewContinueWithRecoveryUiFlow instantiates a new ContinueWithRecoveryUiFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -67,7 +74,7 @@ func (o *ContinueWithRecoveryUiFlow) SetId(v string) { // GetUrl returns the Url field value if set, zero value otherwise. func (o *ContinueWithRecoveryUiFlow) GetUrl() string { - if o == nil || o.Url == nil { + if o == nil || IsNil(o.Url) { var ret string return ret } @@ -77,7 +84,7 @@ func (o *ContinueWithRecoveryUiFlow) GetUrl() string { // GetUrlOk returns a tuple with the Url field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ContinueWithRecoveryUiFlow) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { + if o == nil || IsNil(o.Url) { return nil, false } return o.Url, true @@ -85,7 +92,7 @@ func (o *ContinueWithRecoveryUiFlow) GetUrlOk() (*string, bool) { // HasUrl returns a boolean if a field has been set. func (o *ContinueWithRecoveryUiFlow) HasUrl() bool { - if o != nil && o.Url != nil { + if o != nil && !IsNil(o.Url) { return true } @@ -98,14 +105,57 @@ func (o *ContinueWithRecoveryUiFlow) SetUrl(v string) { } func (o ContinueWithRecoveryUiFlow) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["id"] = o.Id + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Url != nil { + return json.Marshal(toSerialize) +} + +func (o ContinueWithRecoveryUiFlow) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + if !IsNil(o.Url) { toSerialize["url"] = o.Url } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *ContinueWithRecoveryUiFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithRecoveryUiFlow := _ContinueWithRecoveryUiFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithRecoveryUiFlow) + + if err != nil { + return err + } + + *o = ContinueWithRecoveryUiFlow(varContinueWithRecoveryUiFlow) + + return err } type NullableContinueWithRecoveryUiFlow struct { diff --git a/internal/httpclient/model_continue_with_set_ory_session_token.go b/internal/httpclient/model_continue_with_set_ory_session_token.go index 152e1455a98d..2bcddc8b9443 100644 --- a/internal/httpclient/model_continue_with_set_ory_session_token.go +++ b/internal/httpclient/model_continue_with_set_ory_session_token.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithSetOrySessionToken type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithSetOrySessionToken{} + // ContinueWithSetOrySessionToken Indicates that a session was issued, and the application should use this token for authenticated requests type ContinueWithSetOrySessionToken struct { // Action will always be `set_ory_session_token` set_ory_session_token ContinueWithActionSetOrySessionTokenString show_verification_ui ContinueWithActionShowVerificationUIString show_settings_ui ContinueWithActionShowSettingsUIString show_recovery_ui ContinueWithActionShowRecoveryUIString @@ -23,6 +28,8 @@ type ContinueWithSetOrySessionToken struct { OrySessionToken *string `json:"ory_session_token,omitempty"` } +type _ContinueWithSetOrySessionToken ContinueWithSetOrySessionToken + // NewContinueWithSetOrySessionToken instantiates a new ContinueWithSetOrySessionToken object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -67,7 +74,7 @@ func (o *ContinueWithSetOrySessionToken) SetAction(v string) { // GetOrySessionToken returns the OrySessionToken field value if set, zero value otherwise. func (o *ContinueWithSetOrySessionToken) GetOrySessionToken() string { - if o == nil || o.OrySessionToken == nil { + if o == nil || IsNil(o.OrySessionToken) { var ret string return ret } @@ -77,7 +84,7 @@ func (o *ContinueWithSetOrySessionToken) GetOrySessionToken() string { // GetOrySessionTokenOk returns a tuple with the OrySessionToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ContinueWithSetOrySessionToken) GetOrySessionTokenOk() (*string, bool) { - if o == nil || o.OrySessionToken == nil { + if o == nil || IsNil(o.OrySessionToken) { return nil, false } return o.OrySessionToken, true @@ -85,7 +92,7 @@ func (o *ContinueWithSetOrySessionToken) GetOrySessionTokenOk() (*string, bool) // HasOrySessionToken returns a boolean if a field has been set. func (o *ContinueWithSetOrySessionToken) HasOrySessionToken() bool { - if o != nil && o.OrySessionToken != nil { + if o != nil && !IsNil(o.OrySessionToken) { return true } @@ -98,14 +105,57 @@ func (o *ContinueWithSetOrySessionToken) SetOrySessionToken(v string) { } func (o ContinueWithSetOrySessionToken) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["action"] = o.Action + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.OrySessionToken != nil { + return json.Marshal(toSerialize) +} + +func (o ContinueWithSetOrySessionToken) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["action"] = o.Action + if !IsNil(o.OrySessionToken) { toSerialize["ory_session_token"] = o.OrySessionToken } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *ContinueWithSetOrySessionToken) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "action", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithSetOrySessionToken := _ContinueWithSetOrySessionToken{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithSetOrySessionToken) + + if err != nil { + return err + } + + *o = ContinueWithSetOrySessionToken(varContinueWithSetOrySessionToken) + + return err } type NullableContinueWithSetOrySessionToken struct { diff --git a/internal/httpclient/model_continue_with_settings_ui.go b/internal/httpclient/model_continue_with_settings_ui.go index f46cc4c7f696..cd955f00df34 100644 --- a/internal/httpclient/model_continue_with_settings_ui.go +++ b/internal/httpclient/model_continue_with_settings_ui.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithSettingsUi type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithSettingsUi{} + // ContinueWithSettingsUi Indicates, that the UI flow could be continued by showing a settings ui type ContinueWithSettingsUi struct { // Action will always be `show_settings_ui` set_ory_session_token ContinueWithActionSetOrySessionTokenString show_verification_ui ContinueWithActionShowVerificationUIString show_settings_ui ContinueWithActionShowSettingsUIString show_recovery_ui ContinueWithActionShowRecoveryUIString @@ -22,6 +27,8 @@ type ContinueWithSettingsUi struct { Flow *ContinueWithSettingsUiFlow `json:"flow,omitempty"` } +type _ContinueWithSettingsUi ContinueWithSettingsUi + // NewContinueWithSettingsUi instantiates a new ContinueWithSettingsUi object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -66,7 +73,7 @@ func (o *ContinueWithSettingsUi) SetAction(v string) { // GetFlow returns the Flow field value if set, zero value otherwise. func (o *ContinueWithSettingsUi) GetFlow() ContinueWithSettingsUiFlow { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { var ret ContinueWithSettingsUiFlow return ret } @@ -76,7 +83,7 @@ func (o *ContinueWithSettingsUi) GetFlow() ContinueWithSettingsUiFlow { // GetFlowOk returns a tuple with the Flow field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ContinueWithSettingsUi) GetFlowOk() (*ContinueWithSettingsUiFlow, bool) { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { return nil, false } return o.Flow, true @@ -84,7 +91,7 @@ func (o *ContinueWithSettingsUi) GetFlowOk() (*ContinueWithSettingsUiFlow, bool) // HasFlow returns a boolean if a field has been set. func (o *ContinueWithSettingsUi) HasFlow() bool { - if o != nil && o.Flow != nil { + if o != nil && !IsNil(o.Flow) { return true } @@ -97,14 +104,57 @@ func (o *ContinueWithSettingsUi) SetFlow(v ContinueWithSettingsUiFlow) { } func (o ContinueWithSettingsUi) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["action"] = o.Action + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Flow != nil { + return json.Marshal(toSerialize) +} + +func (o ContinueWithSettingsUi) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["action"] = o.Action + if !IsNil(o.Flow) { toSerialize["flow"] = o.Flow } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *ContinueWithSettingsUi) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "action", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithSettingsUi := _ContinueWithSettingsUi{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithSettingsUi) + + if err != nil { + return err + } + + *o = ContinueWithSettingsUi(varContinueWithSettingsUi) + + return err } type NullableContinueWithSettingsUi struct { diff --git a/internal/httpclient/model_continue_with_settings_ui_flow.go b/internal/httpclient/model_continue_with_settings_ui_flow.go index 4ccaf74ef1b8..3635056158f6 100644 --- a/internal/httpclient/model_continue_with_settings_ui_flow.go +++ b/internal/httpclient/model_continue_with_settings_ui_flow.go @@ -1,26 +1,33 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithSettingsUiFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithSettingsUiFlow{} + // ContinueWithSettingsUiFlow struct for ContinueWithSettingsUiFlow type ContinueWithSettingsUiFlow struct { // The ID of the settings flow Id string `json:"id"` } +type _ContinueWithSettingsUiFlow ContinueWithSettingsUiFlow + // NewContinueWithSettingsUiFlow instantiates a new ContinueWithSettingsUiFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -64,13 +71,56 @@ func (o *ContinueWithSettingsUiFlow) SetId(v string) { } func (o ContinueWithSettingsUiFlow) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["id"] = o.Id + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } return json.Marshal(toSerialize) } +func (o ContinueWithSettingsUiFlow) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + return toSerialize, nil +} + +func (o *ContinueWithSettingsUiFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithSettingsUiFlow := _ContinueWithSettingsUiFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithSettingsUiFlow) + + if err != nil { + return err + } + + *o = ContinueWithSettingsUiFlow(varContinueWithSettingsUiFlow) + + return err +} + type NullableContinueWithSettingsUiFlow struct { value *ContinueWithSettingsUiFlow isSet bool diff --git a/internal/httpclient/model_continue_with_verification_ui.go b/internal/httpclient/model_continue_with_verification_ui.go index 8d9ccd046ade..cd9c6e4c0b37 100644 --- a/internal/httpclient/model_continue_with_verification_ui.go +++ b/internal/httpclient/model_continue_with_verification_ui.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithVerificationUi type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithVerificationUi{} + // ContinueWithVerificationUi Indicates, that the UI flow could be continued by showing a verification ui type ContinueWithVerificationUi struct { // Action will always be `show_verification_ui` set_ory_session_token ContinueWithActionSetOrySessionTokenString show_verification_ui ContinueWithActionShowVerificationUIString show_settings_ui ContinueWithActionShowSettingsUIString show_recovery_ui ContinueWithActionShowRecoveryUIString @@ -22,6 +27,8 @@ type ContinueWithVerificationUi struct { Flow *ContinueWithVerificationUiFlow `json:"flow,omitempty"` } +type _ContinueWithVerificationUi ContinueWithVerificationUi + // NewContinueWithVerificationUi instantiates a new ContinueWithVerificationUi object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -66,7 +73,7 @@ func (o *ContinueWithVerificationUi) SetAction(v string) { // GetFlow returns the Flow field value if set, zero value otherwise. func (o *ContinueWithVerificationUi) GetFlow() ContinueWithVerificationUiFlow { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { var ret ContinueWithVerificationUiFlow return ret } @@ -76,7 +83,7 @@ func (o *ContinueWithVerificationUi) GetFlow() ContinueWithVerificationUiFlow { // GetFlowOk returns a tuple with the Flow field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ContinueWithVerificationUi) GetFlowOk() (*ContinueWithVerificationUiFlow, bool) { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { return nil, false } return o.Flow, true @@ -84,7 +91,7 @@ func (o *ContinueWithVerificationUi) GetFlowOk() (*ContinueWithVerificationUiFlo // HasFlow returns a boolean if a field has been set. func (o *ContinueWithVerificationUi) HasFlow() bool { - if o != nil && o.Flow != nil { + if o != nil && !IsNil(o.Flow) { return true } @@ -97,14 +104,57 @@ func (o *ContinueWithVerificationUi) SetFlow(v ContinueWithVerificationUiFlow) { } func (o ContinueWithVerificationUi) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["action"] = o.Action + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Flow != nil { + return json.Marshal(toSerialize) +} + +func (o ContinueWithVerificationUi) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["action"] = o.Action + if !IsNil(o.Flow) { toSerialize["flow"] = o.Flow } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *ContinueWithVerificationUi) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "action", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithVerificationUi := _ContinueWithVerificationUi{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithVerificationUi) + + if err != nil { + return err + } + + *o = ContinueWithVerificationUi(varContinueWithVerificationUi) + + return err } type NullableContinueWithVerificationUi struct { diff --git a/internal/httpclient/model_continue_with_verification_ui_flow.go b/internal/httpclient/model_continue_with_verification_ui_flow.go index 8fdd4609cf93..8313bc74bb91 100644 --- a/internal/httpclient/model_continue_with_verification_ui_flow.go +++ b/internal/httpclient/model_continue_with_verification_ui_flow.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ContinueWithVerificationUiFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContinueWithVerificationUiFlow{} + // ContinueWithVerificationUiFlow struct for ContinueWithVerificationUiFlow type ContinueWithVerificationUiFlow struct { // The ID of the verification flow @@ -25,6 +30,8 @@ type ContinueWithVerificationUiFlow struct { VerifiableAddress string `json:"verifiable_address"` } +type _ContinueWithVerificationUiFlow ContinueWithVerificationUiFlow + // NewContinueWithVerificationUiFlow instantiates a new ContinueWithVerificationUiFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -70,7 +77,7 @@ func (o *ContinueWithVerificationUiFlow) SetId(v string) { // GetUrl returns the Url field value if set, zero value otherwise. func (o *ContinueWithVerificationUiFlow) GetUrl() string { - if o == nil || o.Url == nil { + if o == nil || IsNil(o.Url) { var ret string return ret } @@ -80,7 +87,7 @@ func (o *ContinueWithVerificationUiFlow) GetUrl() string { // GetUrlOk returns a tuple with the Url field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ContinueWithVerificationUiFlow) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { + if o == nil || IsNil(o.Url) { return nil, false } return o.Url, true @@ -88,7 +95,7 @@ func (o *ContinueWithVerificationUiFlow) GetUrlOk() (*string, bool) { // HasUrl returns a boolean if a field has been set. func (o *ContinueWithVerificationUiFlow) HasUrl() bool { - if o != nil && o.Url != nil { + if o != nil && !IsNil(o.Url) { return true } @@ -125,17 +132,59 @@ func (o *ContinueWithVerificationUiFlow) SetVerifiableAddress(v string) { } func (o ContinueWithVerificationUiFlow) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["id"] = o.Id + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Url != nil { + return json.Marshal(toSerialize) +} + +func (o ContinueWithVerificationUiFlow) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + if !IsNil(o.Url) { toSerialize["url"] = o.Url } - if true { - toSerialize["verifiable_address"] = o.VerifiableAddress + toSerialize["verifiable_address"] = o.VerifiableAddress + return toSerialize, nil +} + +func (o *ContinueWithVerificationUiFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "verifiable_address", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContinueWithVerificationUiFlow := _ContinueWithVerificationUiFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContinueWithVerificationUiFlow) + + if err != nil { + return err + } + + *o = ContinueWithVerificationUiFlow(varContinueWithVerificationUiFlow) + + return err } type NullableContinueWithVerificationUiFlow struct { diff --git a/internal/httpclient/model_courier_message_status.go b/internal/httpclient/model_courier_message_status.go index 0ea66ef9de23..d152440a3055 100644 --- a/internal/httpclient/model_courier_message_status.go +++ b/internal/httpclient/model_courier_message_status.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -27,6 +27,14 @@ const ( COURIERMESSAGESTATUS_ABANDONED CourierMessageStatus = "abandoned" ) +// All allowed values of CourierMessageStatus enum +var AllowedCourierMessageStatusEnumValues = []CourierMessageStatus{ + "queued", + "sent", + "processing", + "abandoned", +} + func (v *CourierMessageStatus) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -34,7 +42,7 @@ func (v *CourierMessageStatus) UnmarshalJSON(src []byte) error { return err } enumTypeValue := CourierMessageStatus(value) - for _, existing := range []CourierMessageStatus{"queued", "sent", "processing", "abandoned"} { + for _, existing := range AllowedCourierMessageStatusEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -44,6 +52,27 @@ func (v *CourierMessageStatus) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid CourierMessageStatus", value) } +// NewCourierMessageStatusFromValue returns a pointer to a valid CourierMessageStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCourierMessageStatusFromValue(v string) (*CourierMessageStatus, error) { + ev := CourierMessageStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CourierMessageStatus: valid values are %v", v, AllowedCourierMessageStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CourierMessageStatus) IsValid() bool { + for _, existing := range AllowedCourierMessageStatusEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to courierMessageStatus value func (v CourierMessageStatus) Ptr() *CourierMessageStatus { return &v diff --git a/internal/httpclient/model_courier_message_type.go b/internal/httpclient/model_courier_message_type.go index 9b6811c116d5..28e0a3563741 100644 --- a/internal/httpclient/model_courier_message_type.go +++ b/internal/httpclient/model_courier_message_type.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -25,6 +25,12 @@ const ( COURIERMESSAGETYPE_PHONE CourierMessageType = "phone" ) +// All allowed values of CourierMessageType enum +var AllowedCourierMessageTypeEnumValues = []CourierMessageType{ + "email", + "phone", +} + func (v *CourierMessageType) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -32,7 +38,7 @@ func (v *CourierMessageType) UnmarshalJSON(src []byte) error { return err } enumTypeValue := CourierMessageType(value) - for _, existing := range []CourierMessageType{"email", "phone"} { + for _, existing := range AllowedCourierMessageTypeEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -42,6 +48,27 @@ func (v *CourierMessageType) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid CourierMessageType", value) } +// NewCourierMessageTypeFromValue returns a pointer to a valid CourierMessageType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCourierMessageTypeFromValue(v string) (*CourierMessageType, error) { + ev := CourierMessageType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CourierMessageType: valid values are %v", v, AllowedCourierMessageTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CourierMessageType) IsValid() bool { + for _, existing := range AllowedCourierMessageTypeEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to courierMessageType value func (v CourierMessageType) Ptr() *CourierMessageType { return &v diff --git a/internal/httpclient/model_create_identity_body.go b/internal/httpclient/model_create_identity_body.go index 177317c62d2e..b4fc33e27f9d 100644 --- a/internal/httpclient/model_create_identity_body.go +++ b/internal/httpclient/model_create_identity_body.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the CreateIdentityBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateIdentityBody{} + // CreateIdentityBody Create Identity Body type CreateIdentityBody struct { Credentials *IdentityWithCredentials `json:"credentials,omitempty"` @@ -34,6 +39,8 @@ type CreateIdentityBody struct { VerifiableAddresses []VerifiableIdentityAddress `json:"verifiable_addresses,omitempty"` } +type _CreateIdentityBody CreateIdentityBody + // NewCreateIdentityBody instantiates a new CreateIdentityBody object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -55,7 +62,7 @@ func NewCreateIdentityBodyWithDefaults() *CreateIdentityBody { // GetCredentials returns the Credentials field value if set, zero value otherwise. func (o *CreateIdentityBody) GetCredentials() IdentityWithCredentials { - if o == nil || o.Credentials == nil { + if o == nil || IsNil(o.Credentials) { var ret IdentityWithCredentials return ret } @@ -65,7 +72,7 @@ func (o *CreateIdentityBody) GetCredentials() IdentityWithCredentials { // GetCredentialsOk returns a tuple with the Credentials field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateIdentityBody) GetCredentialsOk() (*IdentityWithCredentials, bool) { - if o == nil || o.Credentials == nil { + if o == nil || IsNil(o.Credentials) { return nil, false } return o.Credentials, true @@ -73,7 +80,7 @@ func (o *CreateIdentityBody) GetCredentialsOk() (*IdentityWithCredentials, bool) // HasCredentials returns a boolean if a field has been set. func (o *CreateIdentityBody) HasCredentials() bool { - if o != nil && o.Credentials != nil { + if o != nil && !IsNil(o.Credentials) { return true } @@ -98,7 +105,7 @@ func (o *CreateIdentityBody) GetMetadataAdmin() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *CreateIdentityBody) GetMetadataAdminOk() (*interface{}, bool) { - if o == nil || o.MetadataAdmin == nil { + if o == nil || IsNil(o.MetadataAdmin) { return nil, false } return &o.MetadataAdmin, true @@ -106,7 +113,7 @@ func (o *CreateIdentityBody) GetMetadataAdminOk() (*interface{}, bool) { // HasMetadataAdmin returns a boolean if a field has been set. func (o *CreateIdentityBody) HasMetadataAdmin() bool { - if o != nil && o.MetadataAdmin != nil { + if o != nil && IsNil(o.MetadataAdmin) { return true } @@ -131,7 +138,7 @@ func (o *CreateIdentityBody) GetMetadataPublic() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *CreateIdentityBody) GetMetadataPublicOk() (*interface{}, bool) { - if o == nil || o.MetadataPublic == nil { + if o == nil || IsNil(o.MetadataPublic) { return nil, false } return &o.MetadataPublic, true @@ -139,7 +146,7 @@ func (o *CreateIdentityBody) GetMetadataPublicOk() (*interface{}, bool) { // HasMetadataPublic returns a boolean if a field has been set. func (o *CreateIdentityBody) HasMetadataPublic() bool { - if o != nil && o.MetadataPublic != nil { + if o != nil && IsNil(o.MetadataPublic) { return true } @@ -153,7 +160,7 @@ func (o *CreateIdentityBody) SetMetadataPublic(v interface{}) { // GetRecoveryAddresses returns the RecoveryAddresses field value if set, zero value otherwise. func (o *CreateIdentityBody) GetRecoveryAddresses() []RecoveryIdentityAddress { - if o == nil || o.RecoveryAddresses == nil { + if o == nil || IsNil(o.RecoveryAddresses) { var ret []RecoveryIdentityAddress return ret } @@ -163,7 +170,7 @@ func (o *CreateIdentityBody) GetRecoveryAddresses() []RecoveryIdentityAddress { // GetRecoveryAddressesOk returns a tuple with the RecoveryAddresses field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateIdentityBody) GetRecoveryAddressesOk() ([]RecoveryIdentityAddress, bool) { - if o == nil || o.RecoveryAddresses == nil { + if o == nil || IsNil(o.RecoveryAddresses) { return nil, false } return o.RecoveryAddresses, true @@ -171,7 +178,7 @@ func (o *CreateIdentityBody) GetRecoveryAddressesOk() ([]RecoveryIdentityAddress // HasRecoveryAddresses returns a boolean if a field has been set. func (o *CreateIdentityBody) HasRecoveryAddresses() bool { - if o != nil && o.RecoveryAddresses != nil { + if o != nil && !IsNil(o.RecoveryAddresses) { return true } @@ -209,7 +216,7 @@ func (o *CreateIdentityBody) SetSchemaId(v string) { // GetState returns the State field value if set, zero value otherwise. func (o *CreateIdentityBody) GetState() string { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { var ret string return ret } @@ -219,7 +226,7 @@ func (o *CreateIdentityBody) GetState() string { // GetStateOk returns a tuple with the State field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateIdentityBody) GetStateOk() (*string, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return o.State, true @@ -227,7 +234,7 @@ func (o *CreateIdentityBody) GetStateOk() (*string, bool) { // HasState returns a boolean if a field has been set. func (o *CreateIdentityBody) HasState() bool { - if o != nil && o.State != nil { + if o != nil && !IsNil(o.State) { return true } @@ -253,7 +260,7 @@ func (o *CreateIdentityBody) GetTraits() map[string]interface{} { // and a boolean to check if the value has been set. func (o *CreateIdentityBody) GetTraitsOk() (map[string]interface{}, bool) { if o == nil { - return nil, false + return map[string]interface{}{}, false } return o.Traits, true } @@ -265,7 +272,7 @@ func (o *CreateIdentityBody) SetTraits(v map[string]interface{}) { // GetVerifiableAddresses returns the VerifiableAddresses field value if set, zero value otherwise. func (o *CreateIdentityBody) GetVerifiableAddresses() []VerifiableIdentityAddress { - if o == nil || o.VerifiableAddresses == nil { + if o == nil || IsNil(o.VerifiableAddresses) { var ret []VerifiableIdentityAddress return ret } @@ -275,7 +282,7 @@ func (o *CreateIdentityBody) GetVerifiableAddresses() []VerifiableIdentityAddres // GetVerifiableAddressesOk returns a tuple with the VerifiableAddresses field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateIdentityBody) GetVerifiableAddressesOk() ([]VerifiableIdentityAddress, bool) { - if o == nil || o.VerifiableAddresses == nil { + if o == nil || IsNil(o.VerifiableAddresses) { return nil, false } return o.VerifiableAddresses, true @@ -283,7 +290,7 @@ func (o *CreateIdentityBody) GetVerifiableAddressesOk() ([]VerifiableIdentityAdd // HasVerifiableAddresses returns a boolean if a field has been set. func (o *CreateIdentityBody) HasVerifiableAddresses() bool { - if o != nil && o.VerifiableAddresses != nil { + if o != nil && !IsNil(o.VerifiableAddresses) { return true } @@ -296,8 +303,16 @@ func (o *CreateIdentityBody) SetVerifiableAddresses(v []VerifiableIdentityAddres } func (o CreateIdentityBody) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateIdentityBody) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Credentials != nil { + if !IsNil(o.Credentials) { toSerialize["credentials"] = o.Credentials } if o.MetadataAdmin != nil { @@ -306,22 +321,56 @@ func (o CreateIdentityBody) MarshalJSON() ([]byte, error) { if o.MetadataPublic != nil { toSerialize["metadata_public"] = o.MetadataPublic } - if o.RecoveryAddresses != nil { + if !IsNil(o.RecoveryAddresses) { toSerialize["recovery_addresses"] = o.RecoveryAddresses } - if true { - toSerialize["schema_id"] = o.SchemaId - } - if o.State != nil { + toSerialize["schema_id"] = o.SchemaId + if !IsNil(o.State) { toSerialize["state"] = o.State } - if true { - toSerialize["traits"] = o.Traits - } - if o.VerifiableAddresses != nil { + toSerialize["traits"] = o.Traits + if !IsNil(o.VerifiableAddresses) { toSerialize["verifiable_addresses"] = o.VerifiableAddresses } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *CreateIdentityBody) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "schema_id", + "traits", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateIdentityBody := _CreateIdentityBody{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateIdentityBody) + + if err != nil { + return err + } + + *o = CreateIdentityBody(varCreateIdentityBody) + + return err } type NullableCreateIdentityBody struct { diff --git a/internal/httpclient/model_create_recovery_code_for_identity_body.go b/internal/httpclient/model_create_recovery_code_for_identity_body.go index 850c7e086206..f37e66518b77 100644 --- a/internal/httpclient/model_create_recovery_code_for_identity_body.go +++ b/internal/httpclient/model_create_recovery_code_for_identity_body.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the CreateRecoveryCodeForIdentityBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateRecoveryCodeForIdentityBody{} + // CreateRecoveryCodeForIdentityBody Create Recovery Code for Identity Request Body type CreateRecoveryCodeForIdentityBody struct { // Code Expires In The recovery code will expire after that amount of time has passed. Defaults to the configuration value of `selfservice.methods.code.config.lifespan`. @@ -23,6 +28,8 @@ type CreateRecoveryCodeForIdentityBody struct { IdentityId string `json:"identity_id"` } +type _CreateRecoveryCodeForIdentityBody CreateRecoveryCodeForIdentityBody + // NewCreateRecoveryCodeForIdentityBody instantiates a new CreateRecoveryCodeForIdentityBody object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -43,7 +50,7 @@ func NewCreateRecoveryCodeForIdentityBodyWithDefaults() *CreateRecoveryCodeForId // GetExpiresIn returns the ExpiresIn field value if set, zero value otherwise. func (o *CreateRecoveryCodeForIdentityBody) GetExpiresIn() string { - if o == nil || o.ExpiresIn == nil { + if o == nil || IsNil(o.ExpiresIn) { var ret string return ret } @@ -53,7 +60,7 @@ func (o *CreateRecoveryCodeForIdentityBody) GetExpiresIn() string { // GetExpiresInOk returns a tuple with the ExpiresIn field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateRecoveryCodeForIdentityBody) GetExpiresInOk() (*string, bool) { - if o == nil || o.ExpiresIn == nil { + if o == nil || IsNil(o.ExpiresIn) { return nil, false } return o.ExpiresIn, true @@ -61,7 +68,7 @@ func (o *CreateRecoveryCodeForIdentityBody) GetExpiresInOk() (*string, bool) { // HasExpiresIn returns a boolean if a field has been set. func (o *CreateRecoveryCodeForIdentityBody) HasExpiresIn() bool { - if o != nil && o.ExpiresIn != nil { + if o != nil && !IsNil(o.ExpiresIn) { return true } @@ -98,14 +105,57 @@ func (o *CreateRecoveryCodeForIdentityBody) SetIdentityId(v string) { } func (o CreateRecoveryCodeForIdentityBody) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateRecoveryCodeForIdentityBody) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.ExpiresIn != nil { + if !IsNil(o.ExpiresIn) { toSerialize["expires_in"] = o.ExpiresIn } - if true { - toSerialize["identity_id"] = o.IdentityId + toSerialize["identity_id"] = o.IdentityId + return toSerialize, nil +} + +func (o *CreateRecoveryCodeForIdentityBody) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "identity_id", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateRecoveryCodeForIdentityBody := _CreateRecoveryCodeForIdentityBody{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateRecoveryCodeForIdentityBody) + + if err != nil { + return err + } + + *o = CreateRecoveryCodeForIdentityBody(varCreateRecoveryCodeForIdentityBody) + + return err } type NullableCreateRecoveryCodeForIdentityBody struct { diff --git a/internal/httpclient/model_create_recovery_link_for_identity_body.go b/internal/httpclient/model_create_recovery_link_for_identity_body.go index 2db109d221bf..2fc45f7cf866 100644 --- a/internal/httpclient/model_create_recovery_link_for_identity_body.go +++ b/internal/httpclient/model_create_recovery_link_for_identity_body.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the CreateRecoveryLinkForIdentityBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateRecoveryLinkForIdentityBody{} + // CreateRecoveryLinkForIdentityBody Create Recovery Link for Identity Request Body type CreateRecoveryLinkForIdentityBody struct { // Link Expires In The recovery link will expire after that amount of time has passed. Defaults to the configuration value of `selfservice.methods.code.config.lifespan`. @@ -23,6 +28,8 @@ type CreateRecoveryLinkForIdentityBody struct { IdentityId string `json:"identity_id"` } +type _CreateRecoveryLinkForIdentityBody CreateRecoveryLinkForIdentityBody + // NewCreateRecoveryLinkForIdentityBody instantiates a new CreateRecoveryLinkForIdentityBody object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -43,7 +50,7 @@ func NewCreateRecoveryLinkForIdentityBodyWithDefaults() *CreateRecoveryLinkForId // GetExpiresIn returns the ExpiresIn field value if set, zero value otherwise. func (o *CreateRecoveryLinkForIdentityBody) GetExpiresIn() string { - if o == nil || o.ExpiresIn == nil { + if o == nil || IsNil(o.ExpiresIn) { var ret string return ret } @@ -53,7 +60,7 @@ func (o *CreateRecoveryLinkForIdentityBody) GetExpiresIn() string { // GetExpiresInOk returns a tuple with the ExpiresIn field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateRecoveryLinkForIdentityBody) GetExpiresInOk() (*string, bool) { - if o == nil || o.ExpiresIn == nil { + if o == nil || IsNil(o.ExpiresIn) { return nil, false } return o.ExpiresIn, true @@ -61,7 +68,7 @@ func (o *CreateRecoveryLinkForIdentityBody) GetExpiresInOk() (*string, bool) { // HasExpiresIn returns a boolean if a field has been set. func (o *CreateRecoveryLinkForIdentityBody) HasExpiresIn() bool { - if o != nil && o.ExpiresIn != nil { + if o != nil && !IsNil(o.ExpiresIn) { return true } @@ -98,14 +105,57 @@ func (o *CreateRecoveryLinkForIdentityBody) SetIdentityId(v string) { } func (o CreateRecoveryLinkForIdentityBody) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateRecoveryLinkForIdentityBody) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.ExpiresIn != nil { + if !IsNil(o.ExpiresIn) { toSerialize["expires_in"] = o.ExpiresIn } - if true { - toSerialize["identity_id"] = o.IdentityId + toSerialize["identity_id"] = o.IdentityId + return toSerialize, nil +} + +func (o *CreateRecoveryLinkForIdentityBody) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "identity_id", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateRecoveryLinkForIdentityBody := _CreateRecoveryLinkForIdentityBody{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateRecoveryLinkForIdentityBody) + + if err != nil { + return err + } + + *o = CreateRecoveryLinkForIdentityBody(varCreateRecoveryLinkForIdentityBody) + + return err } type NullableCreateRecoveryLinkForIdentityBody struct { diff --git a/internal/httpclient/model_delete_my_sessions_count.go b/internal/httpclient/model_delete_my_sessions_count.go index 253834fbff63..4443633be66c 100644 --- a/internal/httpclient/model_delete_my_sessions_count.go +++ b/internal/httpclient/model_delete_my_sessions_count.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the DeleteMySessionsCount type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeleteMySessionsCount{} + // DeleteMySessionsCount Deleted Session Count type DeleteMySessionsCount struct { // The number of sessions that were revoked. @@ -40,7 +43,7 @@ func NewDeleteMySessionsCountWithDefaults() *DeleteMySessionsCount { // GetCount returns the Count field value if set, zero value otherwise. func (o *DeleteMySessionsCount) GetCount() int64 { - if o == nil || o.Count == nil { + if o == nil || IsNil(o.Count) { var ret int64 return ret } @@ -50,7 +53,7 @@ func (o *DeleteMySessionsCount) GetCount() int64 { // GetCountOk returns a tuple with the Count field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeleteMySessionsCount) GetCountOk() (*int64, bool) { - if o == nil || o.Count == nil { + if o == nil || IsNil(o.Count) { return nil, false } return o.Count, true @@ -58,7 +61,7 @@ func (o *DeleteMySessionsCount) GetCountOk() (*int64, bool) { // HasCount returns a boolean if a field has been set. func (o *DeleteMySessionsCount) HasCount() bool { - if o != nil && o.Count != nil { + if o != nil && !IsNil(o.Count) { return true } @@ -71,11 +74,19 @@ func (o *DeleteMySessionsCount) SetCount(v int64) { } func (o DeleteMySessionsCount) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeleteMySessionsCount) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Count != nil { + if !IsNil(o.Count) { toSerialize["count"] = o.Count } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableDeleteMySessionsCount struct { diff --git a/internal/httpclient/model_error_authenticator_assurance_level_not_satisfied.go b/internal/httpclient/model_error_authenticator_assurance_level_not_satisfied.go index b7b29bea8b3a..500a71d09d23 100644 --- a/internal/httpclient/model_error_authenticator_assurance_level_not_satisfied.go +++ b/internal/httpclient/model_error_authenticator_assurance_level_not_satisfied.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the ErrorAuthenticatorAssuranceLevelNotSatisfied type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorAuthenticatorAssuranceLevelNotSatisfied{} + // ErrorAuthenticatorAssuranceLevelNotSatisfied struct for ErrorAuthenticatorAssuranceLevelNotSatisfied type ErrorAuthenticatorAssuranceLevelNotSatisfied struct { Error *GenericError `json:"error,omitempty"` @@ -41,7 +44,7 @@ func NewErrorAuthenticatorAssuranceLevelNotSatisfiedWithDefaults() *ErrorAuthent // GetError returns the Error field value if set, zero value otherwise. func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetError() GenericError { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret GenericError return ret } @@ -51,7 +54,7 @@ func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetError() GenericError { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetErrorOk() (*GenericError, bool) { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { return nil, false } return o.Error, true @@ -59,7 +62,7 @@ func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetErrorOk() (*GenericErr // HasError returns a boolean if a field has been set. func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -73,7 +76,7 @@ func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) SetError(v GenericError) // GetRedirectBrowserTo returns the RedirectBrowserTo field value if set, zero value otherwise. func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetRedirectBrowserTo() string { - if o == nil || o.RedirectBrowserTo == nil { + if o == nil || IsNil(o.RedirectBrowserTo) { var ret string return ret } @@ -83,7 +86,7 @@ func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetRedirectBrowserTo() st // GetRedirectBrowserToOk returns a tuple with the RedirectBrowserTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetRedirectBrowserToOk() (*string, bool) { - if o == nil || o.RedirectBrowserTo == nil { + if o == nil || IsNil(o.RedirectBrowserTo) { return nil, false } return o.RedirectBrowserTo, true @@ -91,7 +94,7 @@ func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) GetRedirectBrowserToOk() // HasRedirectBrowserTo returns a boolean if a field has been set. func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) HasRedirectBrowserTo() bool { - if o != nil && o.RedirectBrowserTo != nil { + if o != nil && !IsNil(o.RedirectBrowserTo) { return true } @@ -104,14 +107,22 @@ func (o *ErrorAuthenticatorAssuranceLevelNotSatisfied) SetRedirectBrowserTo(v st } func (o ErrorAuthenticatorAssuranceLevelNotSatisfied) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorAuthenticatorAssuranceLevelNotSatisfied) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Error != nil { + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if o.RedirectBrowserTo != nil { + if !IsNil(o.RedirectBrowserTo) { toSerialize["redirect_browser_to"] = o.RedirectBrowserTo } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableErrorAuthenticatorAssuranceLevelNotSatisfied struct { diff --git a/internal/httpclient/model_error_browser_location_change_required.go b/internal/httpclient/model_error_browser_location_change_required.go index 4fdf23795557..b4d75871b59a 100644 --- a/internal/httpclient/model_error_browser_location_change_required.go +++ b/internal/httpclient/model_error_browser_location_change_required.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the ErrorBrowserLocationChangeRequired type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorBrowserLocationChangeRequired{} + // ErrorBrowserLocationChangeRequired struct for ErrorBrowserLocationChangeRequired type ErrorBrowserLocationChangeRequired struct { Error *ErrorGeneric `json:"error,omitempty"` @@ -41,7 +44,7 @@ func NewErrorBrowserLocationChangeRequiredWithDefaults() *ErrorBrowserLocationCh // GetError returns the Error field value if set, zero value otherwise. func (o *ErrorBrowserLocationChangeRequired) GetError() ErrorGeneric { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret ErrorGeneric return ret } @@ -51,7 +54,7 @@ func (o *ErrorBrowserLocationChangeRequired) GetError() ErrorGeneric { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorBrowserLocationChangeRequired) GetErrorOk() (*ErrorGeneric, bool) { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { return nil, false } return o.Error, true @@ -59,7 +62,7 @@ func (o *ErrorBrowserLocationChangeRequired) GetErrorOk() (*ErrorGeneric, bool) // HasError returns a boolean if a field has been set. func (o *ErrorBrowserLocationChangeRequired) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -73,7 +76,7 @@ func (o *ErrorBrowserLocationChangeRequired) SetError(v ErrorGeneric) { // GetRedirectBrowserTo returns the RedirectBrowserTo field value if set, zero value otherwise. func (o *ErrorBrowserLocationChangeRequired) GetRedirectBrowserTo() string { - if o == nil || o.RedirectBrowserTo == nil { + if o == nil || IsNil(o.RedirectBrowserTo) { var ret string return ret } @@ -83,7 +86,7 @@ func (o *ErrorBrowserLocationChangeRequired) GetRedirectBrowserTo() string { // GetRedirectBrowserToOk returns a tuple with the RedirectBrowserTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorBrowserLocationChangeRequired) GetRedirectBrowserToOk() (*string, bool) { - if o == nil || o.RedirectBrowserTo == nil { + if o == nil || IsNil(o.RedirectBrowserTo) { return nil, false } return o.RedirectBrowserTo, true @@ -91,7 +94,7 @@ func (o *ErrorBrowserLocationChangeRequired) GetRedirectBrowserToOk() (*string, // HasRedirectBrowserTo returns a boolean if a field has been set. func (o *ErrorBrowserLocationChangeRequired) HasRedirectBrowserTo() bool { - if o != nil && o.RedirectBrowserTo != nil { + if o != nil && !IsNil(o.RedirectBrowserTo) { return true } @@ -104,14 +107,22 @@ func (o *ErrorBrowserLocationChangeRequired) SetRedirectBrowserTo(v string) { } func (o ErrorBrowserLocationChangeRequired) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorBrowserLocationChangeRequired) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Error != nil { + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if o.RedirectBrowserTo != nil { + if !IsNil(o.RedirectBrowserTo) { toSerialize["redirect_browser_to"] = o.RedirectBrowserTo } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableErrorBrowserLocationChangeRequired struct { diff --git a/internal/httpclient/model_error_flow_replaced.go b/internal/httpclient/model_error_flow_replaced.go index 856423abc1ad..2c763983d7c7 100644 --- a/internal/httpclient/model_error_flow_replaced.go +++ b/internal/httpclient/model_error_flow_replaced.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the ErrorFlowReplaced type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorFlowReplaced{} + // ErrorFlowReplaced Is sent when a flow is replaced by a different flow of the same class type ErrorFlowReplaced struct { Error *GenericError `json:"error,omitempty"` @@ -41,7 +44,7 @@ func NewErrorFlowReplacedWithDefaults() *ErrorFlowReplaced { // GetError returns the Error field value if set, zero value otherwise. func (o *ErrorFlowReplaced) GetError() GenericError { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret GenericError return ret } @@ -51,7 +54,7 @@ func (o *ErrorFlowReplaced) GetError() GenericError { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorFlowReplaced) GetErrorOk() (*GenericError, bool) { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { return nil, false } return o.Error, true @@ -59,7 +62,7 @@ func (o *ErrorFlowReplaced) GetErrorOk() (*GenericError, bool) { // HasError returns a boolean if a field has been set. func (o *ErrorFlowReplaced) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -73,7 +76,7 @@ func (o *ErrorFlowReplaced) SetError(v GenericError) { // GetUseFlowId returns the UseFlowId field value if set, zero value otherwise. func (o *ErrorFlowReplaced) GetUseFlowId() string { - if o == nil || o.UseFlowId == nil { + if o == nil || IsNil(o.UseFlowId) { var ret string return ret } @@ -83,7 +86,7 @@ func (o *ErrorFlowReplaced) GetUseFlowId() string { // GetUseFlowIdOk returns a tuple with the UseFlowId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorFlowReplaced) GetUseFlowIdOk() (*string, bool) { - if o == nil || o.UseFlowId == nil { + if o == nil || IsNil(o.UseFlowId) { return nil, false } return o.UseFlowId, true @@ -91,7 +94,7 @@ func (o *ErrorFlowReplaced) GetUseFlowIdOk() (*string, bool) { // HasUseFlowId returns a boolean if a field has been set. func (o *ErrorFlowReplaced) HasUseFlowId() bool { - if o != nil && o.UseFlowId != nil { + if o != nil && !IsNil(o.UseFlowId) { return true } @@ -104,14 +107,22 @@ func (o *ErrorFlowReplaced) SetUseFlowId(v string) { } func (o ErrorFlowReplaced) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorFlowReplaced) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Error != nil { + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if o.UseFlowId != nil { + if !IsNil(o.UseFlowId) { toSerialize["use_flow_id"] = o.UseFlowId } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableErrorFlowReplaced struct { diff --git a/internal/httpclient/model_error_generic.go b/internal/httpclient/model_error_generic.go index f58c90015a42..2e50f7675812 100644 --- a/internal/httpclient/model_error_generic.go +++ b/internal/httpclient/model_error_generic.go @@ -1,25 +1,32 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the ErrorGeneric type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorGeneric{} + // ErrorGeneric The standard Ory JSON API error format. type ErrorGeneric struct { Error GenericError `json:"error"` } +type _ErrorGeneric ErrorGeneric + // NewErrorGeneric instantiates a new ErrorGeneric object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -63,13 +70,56 @@ func (o *ErrorGeneric) SetError(v GenericError) { } func (o ErrorGeneric) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["error"] = o.Error + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } return json.Marshal(toSerialize) } +func (o ErrorGeneric) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["error"] = o.Error + return toSerialize, nil +} + +func (o *ErrorGeneric) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "error", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varErrorGeneric := _ErrorGeneric{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varErrorGeneric) + + if err != nil { + return err + } + + *o = ErrorGeneric(varErrorGeneric) + + return err +} + type NullableErrorGeneric struct { value *ErrorGeneric isSet bool diff --git a/internal/httpclient/model_flow_error.go b/internal/httpclient/model_flow_error.go index e0e8e7ab37c5..22795dbc9c2e 100644 --- a/internal/httpclient/model_flow_error.go +++ b/internal/httpclient/model_flow_error.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the FlowError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FlowError{} + // FlowError struct for FlowError type FlowError struct { // CreatedAt is a helper struct field for gobuffalo.pop. @@ -27,6 +32,8 @@ type FlowError struct { UpdatedAt *time.Time `json:"updated_at,omitempty"` } +type _FlowError FlowError + // NewFlowError instantiates a new FlowError object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -47,7 +54,7 @@ func NewFlowErrorWithDefaults() *FlowError { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *FlowError) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -57,7 +64,7 @@ func (o *FlowError) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *FlowError) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -65,7 +72,7 @@ func (o *FlowError) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *FlowError) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -79,7 +86,7 @@ func (o *FlowError) SetCreatedAt(v time.Time) { // GetError returns the Error field value if set, zero value otherwise. func (o *FlowError) GetError() map[string]interface{} { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret map[string]interface{} return ret } @@ -89,15 +96,15 @@ func (o *FlowError) GetError() map[string]interface{} { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *FlowError) GetErrorOk() (map[string]interface{}, bool) { - if o == nil || o.Error == nil { - return nil, false + if o == nil || IsNil(o.Error) { + return map[string]interface{}{}, false } return o.Error, true } // HasError returns a boolean if a field has been set. func (o *FlowError) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -135,7 +142,7 @@ func (o *FlowError) SetId(v string) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *FlowError) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -145,7 +152,7 @@ func (o *FlowError) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *FlowError) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -153,7 +160,7 @@ func (o *FlowError) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *FlowError) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -166,20 +173,63 @@ func (o *FlowError) SetUpdatedAt(v time.Time) { } func (o FlowError) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FlowError) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if o.Error != nil { + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if true { - toSerialize["id"] = o.Id - } - if o.UpdatedAt != nil { + toSerialize["id"] = o.Id + if !IsNil(o.UpdatedAt) { toSerialize["updated_at"] = o.UpdatedAt } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *FlowError) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varFlowError := _FlowError{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varFlowError) + + if err != nil { + return err + } + + *o = FlowError(varFlowError) + + return err } type NullableFlowError struct { diff --git a/internal/httpclient/model_generic_error.go b/internal/httpclient/model_generic_error.go index fb93065ad37a..46c2f4c2ddd3 100644 --- a/internal/httpclient/model_generic_error.go +++ b/internal/httpclient/model_generic_error.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the GenericError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GenericError{} + // GenericError struct for GenericError type GenericError struct { // The status code @@ -35,6 +40,8 @@ type GenericError struct { Status *string `json:"status,omitempty"` } +type _GenericError GenericError + // NewGenericError instantiates a new GenericError object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -55,7 +62,7 @@ func NewGenericErrorWithDefaults() *GenericError { // GetCode returns the Code field value if set, zero value otherwise. func (o *GenericError) GetCode() int64 { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { var ret int64 return ret } @@ -65,7 +72,7 @@ func (o *GenericError) GetCode() int64 { // GetCodeOk returns a tuple with the Code field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetCodeOk() (*int64, bool) { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { return nil, false } return o.Code, true @@ -73,7 +80,7 @@ func (o *GenericError) GetCodeOk() (*int64, bool) { // HasCode returns a boolean if a field has been set. func (o *GenericError) HasCode() bool { - if o != nil && o.Code != nil { + if o != nil && !IsNil(o.Code) { return true } @@ -87,7 +94,7 @@ func (o *GenericError) SetCode(v int64) { // GetDebug returns the Debug field value if set, zero value otherwise. func (o *GenericError) GetDebug() string { - if o == nil || o.Debug == nil { + if o == nil || IsNil(o.Debug) { var ret string return ret } @@ -97,7 +104,7 @@ func (o *GenericError) GetDebug() string { // GetDebugOk returns a tuple with the Debug field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetDebugOk() (*string, bool) { - if o == nil || o.Debug == nil { + if o == nil || IsNil(o.Debug) { return nil, false } return o.Debug, true @@ -105,7 +112,7 @@ func (o *GenericError) GetDebugOk() (*string, bool) { // HasDebug returns a boolean if a field has been set. func (o *GenericError) HasDebug() bool { - if o != nil && o.Debug != nil { + if o != nil && !IsNil(o.Debug) { return true } @@ -119,7 +126,7 @@ func (o *GenericError) SetDebug(v string) { // GetDetails returns the Details field value if set, zero value otherwise. func (o *GenericError) GetDetails() map[string]interface{} { - if o == nil || o.Details == nil { + if o == nil || IsNil(o.Details) { var ret map[string]interface{} return ret } @@ -129,15 +136,15 @@ func (o *GenericError) GetDetails() map[string]interface{} { // GetDetailsOk returns a tuple with the Details field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetDetailsOk() (map[string]interface{}, bool) { - if o == nil || o.Details == nil { - return nil, false + if o == nil || IsNil(o.Details) { + return map[string]interface{}{}, false } return o.Details, true } // HasDetails returns a boolean if a field has been set. func (o *GenericError) HasDetails() bool { - if o != nil && o.Details != nil { + if o != nil && !IsNil(o.Details) { return true } @@ -151,7 +158,7 @@ func (o *GenericError) SetDetails(v map[string]interface{}) { // GetId returns the Id field value if set, zero value otherwise. func (o *GenericError) GetId() string { - if o == nil || o.Id == nil { + if o == nil || IsNil(o.Id) { var ret string return ret } @@ -161,7 +168,7 @@ func (o *GenericError) GetId() string { // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { + if o == nil || IsNil(o.Id) { return nil, false } return o.Id, true @@ -169,7 +176,7 @@ func (o *GenericError) GetIdOk() (*string, bool) { // HasId returns a boolean if a field has been set. func (o *GenericError) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } @@ -207,7 +214,7 @@ func (o *GenericError) SetMessage(v string) { // GetReason returns the Reason field value if set, zero value otherwise. func (o *GenericError) GetReason() string { - if o == nil || o.Reason == nil { + if o == nil || IsNil(o.Reason) { var ret string return ret } @@ -217,7 +224,7 @@ func (o *GenericError) GetReason() string { // GetReasonOk returns a tuple with the Reason field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetReasonOk() (*string, bool) { - if o == nil || o.Reason == nil { + if o == nil || IsNil(o.Reason) { return nil, false } return o.Reason, true @@ -225,7 +232,7 @@ func (o *GenericError) GetReasonOk() (*string, bool) { // HasReason returns a boolean if a field has been set. func (o *GenericError) HasReason() bool { - if o != nil && o.Reason != nil { + if o != nil && !IsNil(o.Reason) { return true } @@ -239,7 +246,7 @@ func (o *GenericError) SetReason(v string) { // GetRequest returns the Request field value if set, zero value otherwise. func (o *GenericError) GetRequest() string { - if o == nil || o.Request == nil { + if o == nil || IsNil(o.Request) { var ret string return ret } @@ -249,7 +256,7 @@ func (o *GenericError) GetRequest() string { // GetRequestOk returns a tuple with the Request field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetRequestOk() (*string, bool) { - if o == nil || o.Request == nil { + if o == nil || IsNil(o.Request) { return nil, false } return o.Request, true @@ -257,7 +264,7 @@ func (o *GenericError) GetRequestOk() (*string, bool) { // HasRequest returns a boolean if a field has been set. func (o *GenericError) HasRequest() bool { - if o != nil && o.Request != nil { + if o != nil && !IsNil(o.Request) { return true } @@ -271,7 +278,7 @@ func (o *GenericError) SetRequest(v string) { // GetStatus returns the Status field value if set, zero value otherwise. func (o *GenericError) GetStatus() string { - if o == nil || o.Status == nil { + if o == nil || IsNil(o.Status) { var ret string return ret } @@ -281,7 +288,7 @@ func (o *GenericError) GetStatus() string { // GetStatusOk returns a tuple with the Status field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { + if o == nil || IsNil(o.Status) { return nil, false } return o.Status, true @@ -289,7 +296,7 @@ func (o *GenericError) GetStatusOk() (*string, bool) { // HasStatus returns a boolean if a field has been set. func (o *GenericError) HasStatus() bool { - if o != nil && o.Status != nil { + if o != nil && !IsNil(o.Status) { return true } @@ -302,32 +309,75 @@ func (o *GenericError) SetStatus(v string) { } func (o GenericError) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GenericError) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Code != nil { + if !IsNil(o.Code) { toSerialize["code"] = o.Code } - if o.Debug != nil { + if !IsNil(o.Debug) { toSerialize["debug"] = o.Debug } - if o.Details != nil { + if !IsNil(o.Details) { toSerialize["details"] = o.Details } - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - if true { - toSerialize["message"] = o.Message - } - if o.Reason != nil { + toSerialize["message"] = o.Message + if !IsNil(o.Reason) { toSerialize["reason"] = o.Reason } - if o.Request != nil { + if !IsNil(o.Request) { toSerialize["request"] = o.Request } - if o.Status != nil { + if !IsNil(o.Status) { toSerialize["status"] = o.Status } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *GenericError) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "message", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varGenericError := _GenericError{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varGenericError) + + if err != nil { + return err + } + + *o = GenericError(varGenericError) + + return err } type NullableGenericError struct { diff --git a/internal/httpclient/model_get_version_200_response.go b/internal/httpclient/model_get_version_200_response.go index 7dc519c5fd9f..f966a79e3047 100644 --- a/internal/httpclient/model_get_version_200_response.go +++ b/internal/httpclient/model_get_version_200_response.go @@ -1,26 +1,33 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the GetVersion200Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetVersion200Response{} + // GetVersion200Response struct for GetVersion200Response type GetVersion200Response struct { // The version of Ory Kratos. Version string `json:"version"` } +type _GetVersion200Response GetVersion200Response + // NewGetVersion200Response instantiates a new GetVersion200Response object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -64,13 +71,56 @@ func (o *GetVersion200Response) SetVersion(v string) { } func (o GetVersion200Response) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["version"] = o.Version + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } return json.Marshal(toSerialize) } +func (o GetVersion200Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["version"] = o.Version + return toSerialize, nil +} + +func (o *GetVersion200Response) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "version", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varGetVersion200Response := _GetVersion200Response{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varGetVersion200Response) + + if err != nil { + return err + } + + *o = GetVersion200Response(varGetVersion200Response) + + return err +} + type NullableGetVersion200Response struct { value *GetVersion200Response isSet bool diff --git a/internal/httpclient/model_health_not_ready_status.go b/internal/httpclient/model_health_not_ready_status.go index 5ffd294a39e3..d28fad9024d6 100644 --- a/internal/httpclient/model_health_not_ready_status.go +++ b/internal/httpclient/model_health_not_ready_status.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the HealthNotReadyStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HealthNotReadyStatus{} + // HealthNotReadyStatus struct for HealthNotReadyStatus type HealthNotReadyStatus struct { // Errors contains a list of errors that caused the not ready status. @@ -40,7 +43,7 @@ func NewHealthNotReadyStatusWithDefaults() *HealthNotReadyStatus { // GetErrors returns the Errors field value if set, zero value otherwise. func (o *HealthNotReadyStatus) GetErrors() map[string]string { - if o == nil || o.Errors == nil { + if o == nil || IsNil(o.Errors) { var ret map[string]string return ret } @@ -50,7 +53,7 @@ func (o *HealthNotReadyStatus) GetErrors() map[string]string { // GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *HealthNotReadyStatus) GetErrorsOk() (*map[string]string, bool) { - if o == nil || o.Errors == nil { + if o == nil || IsNil(o.Errors) { return nil, false } return o.Errors, true @@ -58,7 +61,7 @@ func (o *HealthNotReadyStatus) GetErrorsOk() (*map[string]string, bool) { // HasErrors returns a boolean if a field has been set. func (o *HealthNotReadyStatus) HasErrors() bool { - if o != nil && o.Errors != nil { + if o != nil && !IsNil(o.Errors) { return true } @@ -71,11 +74,19 @@ func (o *HealthNotReadyStatus) SetErrors(v map[string]string) { } func (o HealthNotReadyStatus) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o HealthNotReadyStatus) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Errors != nil { + if !IsNil(o.Errors) { toSerialize["errors"] = o.Errors } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableHealthNotReadyStatus struct { diff --git a/internal/httpclient/model_health_status.go b/internal/httpclient/model_health_status.go index 8f7cd48ce896..4c9425a7c291 100644 --- a/internal/httpclient/model_health_status.go +++ b/internal/httpclient/model_health_status.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the HealthStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HealthStatus{} + // HealthStatus struct for HealthStatus type HealthStatus struct { // Status always contains \"ok\". @@ -40,7 +43,7 @@ func NewHealthStatusWithDefaults() *HealthStatus { // GetStatus returns the Status field value if set, zero value otherwise. func (o *HealthStatus) GetStatus() string { - if o == nil || o.Status == nil { + if o == nil || IsNil(o.Status) { var ret string return ret } @@ -50,7 +53,7 @@ func (o *HealthStatus) GetStatus() string { // GetStatusOk returns a tuple with the Status field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *HealthStatus) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { + if o == nil || IsNil(o.Status) { return nil, false } return o.Status, true @@ -58,7 +61,7 @@ func (o *HealthStatus) GetStatusOk() (*string, bool) { // HasStatus returns a boolean if a field has been set. func (o *HealthStatus) HasStatus() bool { - if o != nil && o.Status != nil { + if o != nil && !IsNil(o.Status) { return true } @@ -71,11 +74,19 @@ func (o *HealthStatus) SetStatus(v string) { } func (o HealthStatus) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o HealthStatus) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Status != nil { + if !IsNil(o.Status) { toSerialize["status"] = o.Status } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableHealthStatus struct { diff --git a/internal/httpclient/model_identity.go b/internal/httpclient/model_identity.go index cd939965877d..a7d656604de4 100644 --- a/internal/httpclient/model_identity.go +++ b/internal/httpclient/model_identity.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the Identity type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Identity{} + // Identity An [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) represents a (human) user in Ory. type Identity struct { // CreatedAt is a helper struct field for gobuffalo.pop. @@ -46,6 +51,8 @@ type Identity struct { VerifiableAddresses []VerifiableIdentityAddress `json:"verifiable_addresses,omitempty"` } +type _Identity Identity + // NewIdentity instantiates a new Identity object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -69,7 +76,7 @@ func NewIdentityWithDefaults() *Identity { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *Identity) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -79,7 +86,7 @@ func (o *Identity) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -87,7 +94,7 @@ func (o *Identity) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *Identity) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -101,7 +108,7 @@ func (o *Identity) SetCreatedAt(v time.Time) { // GetCredentials returns the Credentials field value if set, zero value otherwise. func (o *Identity) GetCredentials() map[string]IdentityCredentials { - if o == nil || o.Credentials == nil { + if o == nil || IsNil(o.Credentials) { var ret map[string]IdentityCredentials return ret } @@ -111,7 +118,7 @@ func (o *Identity) GetCredentials() map[string]IdentityCredentials { // GetCredentialsOk returns a tuple with the Credentials field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetCredentialsOk() (*map[string]IdentityCredentials, bool) { - if o == nil || o.Credentials == nil { + if o == nil || IsNil(o.Credentials) { return nil, false } return o.Credentials, true @@ -119,7 +126,7 @@ func (o *Identity) GetCredentialsOk() (*map[string]IdentityCredentials, bool) { // HasCredentials returns a boolean if a field has been set. func (o *Identity) HasCredentials() bool { - if o != nil && o.Credentials != nil { + if o != nil && !IsNil(o.Credentials) { return true } @@ -168,7 +175,7 @@ func (o *Identity) GetMetadataAdmin() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *Identity) GetMetadataAdminOk() (*interface{}, bool) { - if o == nil || o.MetadataAdmin == nil { + if o == nil || IsNil(o.MetadataAdmin) { return nil, false } return &o.MetadataAdmin, true @@ -176,7 +183,7 @@ func (o *Identity) GetMetadataAdminOk() (*interface{}, bool) { // HasMetadataAdmin returns a boolean if a field has been set. func (o *Identity) HasMetadataAdmin() bool { - if o != nil && o.MetadataAdmin != nil { + if o != nil && IsNil(o.MetadataAdmin) { return true } @@ -201,7 +208,7 @@ func (o *Identity) GetMetadataPublic() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *Identity) GetMetadataPublicOk() (*interface{}, bool) { - if o == nil || o.MetadataPublic == nil { + if o == nil || IsNil(o.MetadataPublic) { return nil, false } return &o.MetadataPublic, true @@ -209,7 +216,7 @@ func (o *Identity) GetMetadataPublicOk() (*interface{}, bool) { // HasMetadataPublic returns a boolean if a field has been set. func (o *Identity) HasMetadataPublic() bool { - if o != nil && o.MetadataPublic != nil { + if o != nil && IsNil(o.MetadataPublic) { return true } @@ -223,7 +230,7 @@ func (o *Identity) SetMetadataPublic(v interface{}) { // GetOrganizationId returns the OrganizationId field value if set, zero value otherwise (both if not set or set to explicit null). func (o *Identity) GetOrganizationId() string { - if o == nil || o.OrganizationId.Get() == nil { + if o == nil || IsNil(o.OrganizationId.Get()) { var ret string return ret } @@ -266,7 +273,7 @@ func (o *Identity) UnsetOrganizationId() { // GetRecoveryAddresses returns the RecoveryAddresses field value if set, zero value otherwise. func (o *Identity) GetRecoveryAddresses() []RecoveryIdentityAddress { - if o == nil || o.RecoveryAddresses == nil { + if o == nil || IsNil(o.RecoveryAddresses) { var ret []RecoveryIdentityAddress return ret } @@ -276,7 +283,7 @@ func (o *Identity) GetRecoveryAddresses() []RecoveryIdentityAddress { // GetRecoveryAddressesOk returns a tuple with the RecoveryAddresses field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetRecoveryAddressesOk() ([]RecoveryIdentityAddress, bool) { - if o == nil || o.RecoveryAddresses == nil { + if o == nil || IsNil(o.RecoveryAddresses) { return nil, false } return o.RecoveryAddresses, true @@ -284,7 +291,7 @@ func (o *Identity) GetRecoveryAddressesOk() ([]RecoveryIdentityAddress, bool) { // HasRecoveryAddresses returns a boolean if a field has been set. func (o *Identity) HasRecoveryAddresses() bool { - if o != nil && o.RecoveryAddresses != nil { + if o != nil && !IsNil(o.RecoveryAddresses) { return true } @@ -346,7 +353,7 @@ func (o *Identity) SetSchemaUrl(v string) { // GetState returns the State field value if set, zero value otherwise. func (o *Identity) GetState() string { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { var ret string return ret } @@ -356,7 +363,7 @@ func (o *Identity) GetState() string { // GetStateOk returns a tuple with the State field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetStateOk() (*string, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return o.State, true @@ -364,7 +371,7 @@ func (o *Identity) GetStateOk() (*string, bool) { // HasState returns a boolean if a field has been set. func (o *Identity) HasState() bool { - if o != nil && o.State != nil { + if o != nil && !IsNil(o.State) { return true } @@ -378,7 +385,7 @@ func (o *Identity) SetState(v string) { // GetStateChangedAt returns the StateChangedAt field value if set, zero value otherwise. func (o *Identity) GetStateChangedAt() time.Time { - if o == nil || o.StateChangedAt == nil { + if o == nil || IsNil(o.StateChangedAt) { var ret time.Time return ret } @@ -388,7 +395,7 @@ func (o *Identity) GetStateChangedAt() time.Time { // GetStateChangedAtOk returns a tuple with the StateChangedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetStateChangedAtOk() (*time.Time, bool) { - if o == nil || o.StateChangedAt == nil { + if o == nil || IsNil(o.StateChangedAt) { return nil, false } return o.StateChangedAt, true @@ -396,7 +403,7 @@ func (o *Identity) GetStateChangedAtOk() (*time.Time, bool) { // HasStateChangedAt returns a boolean if a field has been set. func (o *Identity) HasStateChangedAt() bool { - if o != nil && o.StateChangedAt != nil { + if o != nil && !IsNil(o.StateChangedAt) { return true } @@ -423,7 +430,7 @@ func (o *Identity) GetTraits() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *Identity) GetTraitsOk() (*interface{}, bool) { - if o == nil || o.Traits == nil { + if o == nil || IsNil(o.Traits) { return nil, false } return &o.Traits, true @@ -436,7 +443,7 @@ func (o *Identity) SetTraits(v interface{}) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *Identity) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -446,7 +453,7 @@ func (o *Identity) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -454,7 +461,7 @@ func (o *Identity) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *Identity) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -468,7 +475,7 @@ func (o *Identity) SetUpdatedAt(v time.Time) { // GetVerifiableAddresses returns the VerifiableAddresses field value if set, zero value otherwise. func (o *Identity) GetVerifiableAddresses() []VerifiableIdentityAddress { - if o == nil || o.VerifiableAddresses == nil { + if o == nil || IsNil(o.VerifiableAddresses) { var ret []VerifiableIdentityAddress return ret } @@ -478,7 +485,7 @@ func (o *Identity) GetVerifiableAddresses() []VerifiableIdentityAddress { // GetVerifiableAddressesOk returns a tuple with the VerifiableAddresses field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Identity) GetVerifiableAddressesOk() ([]VerifiableIdentityAddress, bool) { - if o == nil || o.VerifiableAddresses == nil { + if o == nil || IsNil(o.VerifiableAddresses) { return nil, false } return o.VerifiableAddresses, true @@ -486,7 +493,7 @@ func (o *Identity) GetVerifiableAddressesOk() ([]VerifiableIdentityAddress, bool // HasVerifiableAddresses returns a boolean if a field has been set. func (o *Identity) HasVerifiableAddresses() bool { - if o != nil && o.VerifiableAddresses != nil { + if o != nil && !IsNil(o.VerifiableAddresses) { return true } @@ -499,16 +506,22 @@ func (o *Identity) SetVerifiableAddresses(v []VerifiableIdentityAddress) { } func (o Identity) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Identity) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if o.Credentials != nil { + if !IsNil(o.Credentials) { toSerialize["credentials"] = o.Credentials } - if true { - toSerialize["id"] = o.Id - } + toSerialize["id"] = o.Id if o.MetadataAdmin != nil { toSerialize["metadata_admin"] = o.MetadataAdmin } @@ -518,31 +531,67 @@ func (o Identity) MarshalJSON() ([]byte, error) { if o.OrganizationId.IsSet() { toSerialize["organization_id"] = o.OrganizationId.Get() } - if o.RecoveryAddresses != nil { + if !IsNil(o.RecoveryAddresses) { toSerialize["recovery_addresses"] = o.RecoveryAddresses } - if true { - toSerialize["schema_id"] = o.SchemaId - } - if true { - toSerialize["schema_url"] = o.SchemaUrl - } - if o.State != nil { + toSerialize["schema_id"] = o.SchemaId + toSerialize["schema_url"] = o.SchemaUrl + if !IsNil(o.State) { toSerialize["state"] = o.State } - if o.StateChangedAt != nil { + if !IsNil(o.StateChangedAt) { toSerialize["state_changed_at"] = o.StateChangedAt } if o.Traits != nil { toSerialize["traits"] = o.Traits } - if o.UpdatedAt != nil { + if !IsNil(o.UpdatedAt) { toSerialize["updated_at"] = o.UpdatedAt } - if o.VerifiableAddresses != nil { + if !IsNil(o.VerifiableAddresses) { toSerialize["verifiable_addresses"] = o.VerifiableAddresses } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *Identity) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "schema_id", + "schema_url", + "traits", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIdentity := _Identity{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIdentity) + + if err != nil { + return err + } + + *o = Identity(varIdentity) + + return err } type NullableIdentity struct { diff --git a/internal/httpclient/model_identity_credentials.go b/internal/httpclient/model_identity_credentials.go index 5b454383d520..2b4cda882921 100644 --- a/internal/httpclient/model_identity_credentials.go +++ b/internal/httpclient/model_identity_credentials.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -16,6 +16,9 @@ import ( "time" ) +// checks if the IdentityCredentials type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityCredentials{} + // IdentityCredentials Credentials represents a specific credential type type IdentityCredentials struct { Config map[string]interface{} `json:"config,omitempty"` @@ -50,7 +53,7 @@ func NewIdentityCredentialsWithDefaults() *IdentityCredentials { // GetConfig returns the Config field value if set, zero value otherwise. func (o *IdentityCredentials) GetConfig() map[string]interface{} { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { var ret map[string]interface{} return ret } @@ -60,15 +63,15 @@ func (o *IdentityCredentials) GetConfig() map[string]interface{} { // GetConfigOk returns a tuple with the Config field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentials) GetConfigOk() (map[string]interface{}, bool) { - if o == nil || o.Config == nil { - return nil, false + if o == nil || IsNil(o.Config) { + return map[string]interface{}{}, false } return o.Config, true } // HasConfig returns a boolean if a field has been set. func (o *IdentityCredentials) HasConfig() bool { - if o != nil && o.Config != nil { + if o != nil && !IsNil(o.Config) { return true } @@ -82,7 +85,7 @@ func (o *IdentityCredentials) SetConfig(v map[string]interface{}) { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *IdentityCredentials) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -92,7 +95,7 @@ func (o *IdentityCredentials) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentials) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -100,7 +103,7 @@ func (o *IdentityCredentials) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *IdentityCredentials) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -114,7 +117,7 @@ func (o *IdentityCredentials) SetCreatedAt(v time.Time) { // GetIdentifiers returns the Identifiers field value if set, zero value otherwise. func (o *IdentityCredentials) GetIdentifiers() []string { - if o == nil || o.Identifiers == nil { + if o == nil || IsNil(o.Identifiers) { var ret []string return ret } @@ -124,7 +127,7 @@ func (o *IdentityCredentials) GetIdentifiers() []string { // GetIdentifiersOk returns a tuple with the Identifiers field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentials) GetIdentifiersOk() ([]string, bool) { - if o == nil || o.Identifiers == nil { + if o == nil || IsNil(o.Identifiers) { return nil, false } return o.Identifiers, true @@ -132,7 +135,7 @@ func (o *IdentityCredentials) GetIdentifiersOk() ([]string, bool) { // HasIdentifiers returns a boolean if a field has been set. func (o *IdentityCredentials) HasIdentifiers() bool { - if o != nil && o.Identifiers != nil { + if o != nil && !IsNil(o.Identifiers) { return true } @@ -146,7 +149,7 @@ func (o *IdentityCredentials) SetIdentifiers(v []string) { // GetType returns the Type field value if set, zero value otherwise. func (o *IdentityCredentials) GetType() string { - if o == nil || o.Type == nil { + if o == nil || IsNil(o.Type) { var ret string return ret } @@ -156,7 +159,7 @@ func (o *IdentityCredentials) GetType() string { // GetTypeOk returns a tuple with the Type field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentials) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { + if o == nil || IsNil(o.Type) { return nil, false } return o.Type, true @@ -164,7 +167,7 @@ func (o *IdentityCredentials) GetTypeOk() (*string, bool) { // HasType returns a boolean if a field has been set. func (o *IdentityCredentials) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } @@ -178,7 +181,7 @@ func (o *IdentityCredentials) SetType(v string) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *IdentityCredentials) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -188,7 +191,7 @@ func (o *IdentityCredentials) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentials) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -196,7 +199,7 @@ func (o *IdentityCredentials) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *IdentityCredentials) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -210,7 +213,7 @@ func (o *IdentityCredentials) SetUpdatedAt(v time.Time) { // GetVersion returns the Version field value if set, zero value otherwise. func (o *IdentityCredentials) GetVersion() int64 { - if o == nil || o.Version == nil { + if o == nil || IsNil(o.Version) { var ret int64 return ret } @@ -220,7 +223,7 @@ func (o *IdentityCredentials) GetVersion() int64 { // GetVersionOk returns a tuple with the Version field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentials) GetVersionOk() (*int64, bool) { - if o == nil || o.Version == nil { + if o == nil || IsNil(o.Version) { return nil, false } return o.Version, true @@ -228,7 +231,7 @@ func (o *IdentityCredentials) GetVersionOk() (*int64, bool) { // HasVersion returns a boolean if a field has been set. func (o *IdentityCredentials) HasVersion() bool { - if o != nil && o.Version != nil { + if o != nil && !IsNil(o.Version) { return true } @@ -241,26 +244,34 @@ func (o *IdentityCredentials) SetVersion(v int64) { } func (o IdentityCredentials) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityCredentials) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Config != nil { + if !IsNil(o.Config) { toSerialize["config"] = o.Config } - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if o.Identifiers != nil { + if !IsNil(o.Identifiers) { toSerialize["identifiers"] = o.Identifiers } - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - if o.UpdatedAt != nil { + if !IsNil(o.UpdatedAt) { toSerialize["updated_at"] = o.UpdatedAt } - if o.Version != nil { + if !IsNil(o.Version) { toSerialize["version"] = o.Version } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityCredentials struct { diff --git a/internal/httpclient/model_identity_credentials_code.go b/internal/httpclient/model_identity_credentials_code.go index 75857f31c272..eb91f7f97933 100644 --- a/internal/httpclient/model_identity_credentials_code.go +++ b/internal/httpclient/model_identity_credentials_code.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -16,6 +16,9 @@ import ( "time" ) +// checks if the IdentityCredentialsCode type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityCredentialsCode{} + // IdentityCredentialsCode CredentialsCode represents a one time login/registration code type IdentityCredentialsCode struct { // The type of the address for this code @@ -42,7 +45,7 @@ func NewIdentityCredentialsCodeWithDefaults() *IdentityCredentialsCode { // GetAddressType returns the AddressType field value if set, zero value otherwise. func (o *IdentityCredentialsCode) GetAddressType() string { - if o == nil || o.AddressType == nil { + if o == nil || IsNil(o.AddressType) { var ret string return ret } @@ -52,7 +55,7 @@ func (o *IdentityCredentialsCode) GetAddressType() string { // GetAddressTypeOk returns a tuple with the AddressType field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsCode) GetAddressTypeOk() (*string, bool) { - if o == nil || o.AddressType == nil { + if o == nil || IsNil(o.AddressType) { return nil, false } return o.AddressType, true @@ -60,7 +63,7 @@ func (o *IdentityCredentialsCode) GetAddressTypeOk() (*string, bool) { // HasAddressType returns a boolean if a field has been set. func (o *IdentityCredentialsCode) HasAddressType() bool { - if o != nil && o.AddressType != nil { + if o != nil && !IsNil(o.AddressType) { return true } @@ -74,7 +77,7 @@ func (o *IdentityCredentialsCode) SetAddressType(v string) { // GetUsedAt returns the UsedAt field value if set, zero value otherwise (both if not set or set to explicit null). func (o *IdentityCredentialsCode) GetUsedAt() time.Time { - if o == nil || o.UsedAt.Get() == nil { + if o == nil || IsNil(o.UsedAt.Get()) { var ret time.Time return ret } @@ -116,14 +119,22 @@ func (o *IdentityCredentialsCode) UnsetUsedAt() { } func (o IdentityCredentialsCode) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityCredentialsCode) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.AddressType != nil { + if !IsNil(o.AddressType) { toSerialize["address_type"] = o.AddressType } if o.UsedAt.IsSet() { toSerialize["used_at"] = o.UsedAt.Get() } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityCredentialsCode struct { diff --git a/internal/httpclient/model_identity_credentials_oidc.go b/internal/httpclient/model_identity_credentials_oidc.go index ffb2dfadaa14..db3f2cf74716 100644 --- a/internal/httpclient/model_identity_credentials_oidc.go +++ b/internal/httpclient/model_identity_credentials_oidc.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityCredentialsOidc type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityCredentialsOidc{} + // IdentityCredentialsOidc struct for IdentityCredentialsOidc type IdentityCredentialsOidc struct { Providers []IdentityCredentialsOidcProvider `json:"providers,omitempty"` @@ -39,7 +42,7 @@ func NewIdentityCredentialsOidcWithDefaults() *IdentityCredentialsOidc { // GetProviders returns the Providers field value if set, zero value otherwise. func (o *IdentityCredentialsOidc) GetProviders() []IdentityCredentialsOidcProvider { - if o == nil || o.Providers == nil { + if o == nil || IsNil(o.Providers) { var ret []IdentityCredentialsOidcProvider return ret } @@ -49,7 +52,7 @@ func (o *IdentityCredentialsOidc) GetProviders() []IdentityCredentialsOidcProvid // GetProvidersOk returns a tuple with the Providers field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidc) GetProvidersOk() ([]IdentityCredentialsOidcProvider, bool) { - if o == nil || o.Providers == nil { + if o == nil || IsNil(o.Providers) { return nil, false } return o.Providers, true @@ -57,7 +60,7 @@ func (o *IdentityCredentialsOidc) GetProvidersOk() ([]IdentityCredentialsOidcPro // HasProviders returns a boolean if a field has been set. func (o *IdentityCredentialsOidc) HasProviders() bool { - if o != nil && o.Providers != nil { + if o != nil && !IsNil(o.Providers) { return true } @@ -70,11 +73,19 @@ func (o *IdentityCredentialsOidc) SetProviders(v []IdentityCredentialsOidcProvid } func (o IdentityCredentialsOidc) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityCredentialsOidc) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Providers != nil { + if !IsNil(o.Providers) { toSerialize["providers"] = o.Providers } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityCredentialsOidc struct { diff --git a/internal/httpclient/model_identity_credentials_oidc_provider.go b/internal/httpclient/model_identity_credentials_oidc_provider.go index f905f2f60413..06c433b232a6 100644 --- a/internal/httpclient/model_identity_credentials_oidc_provider.go +++ b/internal/httpclient/model_identity_credentials_oidc_provider.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityCredentialsOidcProvider type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityCredentialsOidcProvider{} + // IdentityCredentialsOidcProvider struct for IdentityCredentialsOidcProvider type IdentityCredentialsOidcProvider struct { InitialAccessToken *string `json:"initial_access_token,omitempty"` @@ -44,7 +47,7 @@ func NewIdentityCredentialsOidcProviderWithDefaults() *IdentityCredentialsOidcPr // GetInitialAccessToken returns the InitialAccessToken field value if set, zero value otherwise. func (o *IdentityCredentialsOidcProvider) GetInitialAccessToken() string { - if o == nil || o.InitialAccessToken == nil { + if o == nil || IsNil(o.InitialAccessToken) { var ret string return ret } @@ -54,7 +57,7 @@ func (o *IdentityCredentialsOidcProvider) GetInitialAccessToken() string { // GetInitialAccessTokenOk returns a tuple with the InitialAccessToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidcProvider) GetInitialAccessTokenOk() (*string, bool) { - if o == nil || o.InitialAccessToken == nil { + if o == nil || IsNil(o.InitialAccessToken) { return nil, false } return o.InitialAccessToken, true @@ -62,7 +65,7 @@ func (o *IdentityCredentialsOidcProvider) GetInitialAccessTokenOk() (*string, bo // HasInitialAccessToken returns a boolean if a field has been set. func (o *IdentityCredentialsOidcProvider) HasInitialAccessToken() bool { - if o != nil && o.InitialAccessToken != nil { + if o != nil && !IsNil(o.InitialAccessToken) { return true } @@ -76,7 +79,7 @@ func (o *IdentityCredentialsOidcProvider) SetInitialAccessToken(v string) { // GetInitialIdToken returns the InitialIdToken field value if set, zero value otherwise. func (o *IdentityCredentialsOidcProvider) GetInitialIdToken() string { - if o == nil || o.InitialIdToken == nil { + if o == nil || IsNil(o.InitialIdToken) { var ret string return ret } @@ -86,7 +89,7 @@ func (o *IdentityCredentialsOidcProvider) GetInitialIdToken() string { // GetInitialIdTokenOk returns a tuple with the InitialIdToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidcProvider) GetInitialIdTokenOk() (*string, bool) { - if o == nil || o.InitialIdToken == nil { + if o == nil || IsNil(o.InitialIdToken) { return nil, false } return o.InitialIdToken, true @@ -94,7 +97,7 @@ func (o *IdentityCredentialsOidcProvider) GetInitialIdTokenOk() (*string, bool) // HasInitialIdToken returns a boolean if a field has been set. func (o *IdentityCredentialsOidcProvider) HasInitialIdToken() bool { - if o != nil && o.InitialIdToken != nil { + if o != nil && !IsNil(o.InitialIdToken) { return true } @@ -108,7 +111,7 @@ func (o *IdentityCredentialsOidcProvider) SetInitialIdToken(v string) { // GetInitialRefreshToken returns the InitialRefreshToken field value if set, zero value otherwise. func (o *IdentityCredentialsOidcProvider) GetInitialRefreshToken() string { - if o == nil || o.InitialRefreshToken == nil { + if o == nil || IsNil(o.InitialRefreshToken) { var ret string return ret } @@ -118,7 +121,7 @@ func (o *IdentityCredentialsOidcProvider) GetInitialRefreshToken() string { // GetInitialRefreshTokenOk returns a tuple with the InitialRefreshToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidcProvider) GetInitialRefreshTokenOk() (*string, bool) { - if o == nil || o.InitialRefreshToken == nil { + if o == nil || IsNil(o.InitialRefreshToken) { return nil, false } return o.InitialRefreshToken, true @@ -126,7 +129,7 @@ func (o *IdentityCredentialsOidcProvider) GetInitialRefreshTokenOk() (*string, b // HasInitialRefreshToken returns a boolean if a field has been set. func (o *IdentityCredentialsOidcProvider) HasInitialRefreshToken() bool { - if o != nil && o.InitialRefreshToken != nil { + if o != nil && !IsNil(o.InitialRefreshToken) { return true } @@ -140,7 +143,7 @@ func (o *IdentityCredentialsOidcProvider) SetInitialRefreshToken(v string) { // GetOrganization returns the Organization field value if set, zero value otherwise. func (o *IdentityCredentialsOidcProvider) GetOrganization() string { - if o == nil || o.Organization == nil { + if o == nil || IsNil(o.Organization) { var ret string return ret } @@ -150,7 +153,7 @@ func (o *IdentityCredentialsOidcProvider) GetOrganization() string { // GetOrganizationOk returns a tuple with the Organization field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidcProvider) GetOrganizationOk() (*string, bool) { - if o == nil || o.Organization == nil { + if o == nil || IsNil(o.Organization) { return nil, false } return o.Organization, true @@ -158,7 +161,7 @@ func (o *IdentityCredentialsOidcProvider) GetOrganizationOk() (*string, bool) { // HasOrganization returns a boolean if a field has been set. func (o *IdentityCredentialsOidcProvider) HasOrganization() bool { - if o != nil && o.Organization != nil { + if o != nil && !IsNil(o.Organization) { return true } @@ -172,7 +175,7 @@ func (o *IdentityCredentialsOidcProvider) SetOrganization(v string) { // GetProvider returns the Provider field value if set, zero value otherwise. func (o *IdentityCredentialsOidcProvider) GetProvider() string { - if o == nil || o.Provider == nil { + if o == nil || IsNil(o.Provider) { var ret string return ret } @@ -182,7 +185,7 @@ func (o *IdentityCredentialsOidcProvider) GetProvider() string { // GetProviderOk returns a tuple with the Provider field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidcProvider) GetProviderOk() (*string, bool) { - if o == nil || o.Provider == nil { + if o == nil || IsNil(o.Provider) { return nil, false } return o.Provider, true @@ -190,7 +193,7 @@ func (o *IdentityCredentialsOidcProvider) GetProviderOk() (*string, bool) { // HasProvider returns a boolean if a field has been set. func (o *IdentityCredentialsOidcProvider) HasProvider() bool { - if o != nil && o.Provider != nil { + if o != nil && !IsNil(o.Provider) { return true } @@ -204,7 +207,7 @@ func (o *IdentityCredentialsOidcProvider) SetProvider(v string) { // GetSubject returns the Subject field value if set, zero value otherwise. func (o *IdentityCredentialsOidcProvider) GetSubject() string { - if o == nil || o.Subject == nil { + if o == nil || IsNil(o.Subject) { var ret string return ret } @@ -214,7 +217,7 @@ func (o *IdentityCredentialsOidcProvider) GetSubject() string { // GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsOidcProvider) GetSubjectOk() (*string, bool) { - if o == nil || o.Subject == nil { + if o == nil || IsNil(o.Subject) { return nil, false } return o.Subject, true @@ -222,7 +225,7 @@ func (o *IdentityCredentialsOidcProvider) GetSubjectOk() (*string, bool) { // HasSubject returns a boolean if a field has been set. func (o *IdentityCredentialsOidcProvider) HasSubject() bool { - if o != nil && o.Subject != nil { + if o != nil && !IsNil(o.Subject) { return true } @@ -235,26 +238,34 @@ func (o *IdentityCredentialsOidcProvider) SetSubject(v string) { } func (o IdentityCredentialsOidcProvider) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityCredentialsOidcProvider) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.InitialAccessToken != nil { + if !IsNil(o.InitialAccessToken) { toSerialize["initial_access_token"] = o.InitialAccessToken } - if o.InitialIdToken != nil { + if !IsNil(o.InitialIdToken) { toSerialize["initial_id_token"] = o.InitialIdToken } - if o.InitialRefreshToken != nil { + if !IsNil(o.InitialRefreshToken) { toSerialize["initial_refresh_token"] = o.InitialRefreshToken } - if o.Organization != nil { + if !IsNil(o.Organization) { toSerialize["organization"] = o.Organization } - if o.Provider != nil { + if !IsNil(o.Provider) { toSerialize["provider"] = o.Provider } - if o.Subject != nil { + if !IsNil(o.Subject) { toSerialize["subject"] = o.Subject } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityCredentialsOidcProvider struct { diff --git a/internal/httpclient/model_identity_credentials_password.go b/internal/httpclient/model_identity_credentials_password.go index 85f942fb6852..0edf148e37c7 100644 --- a/internal/httpclient/model_identity_credentials_password.go +++ b/internal/httpclient/model_identity_credentials_password.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityCredentialsPassword type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityCredentialsPassword{} + // IdentityCredentialsPassword struct for IdentityCredentialsPassword type IdentityCredentialsPassword struct { // HashedPassword is a hash-representation of the password. @@ -40,7 +43,7 @@ func NewIdentityCredentialsPasswordWithDefaults() *IdentityCredentialsPassword { // GetHashedPassword returns the HashedPassword field value if set, zero value otherwise. func (o *IdentityCredentialsPassword) GetHashedPassword() string { - if o == nil || o.HashedPassword == nil { + if o == nil || IsNil(o.HashedPassword) { var ret string return ret } @@ -50,7 +53,7 @@ func (o *IdentityCredentialsPassword) GetHashedPassword() string { // GetHashedPasswordOk returns a tuple with the HashedPassword field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityCredentialsPassword) GetHashedPasswordOk() (*string, bool) { - if o == nil || o.HashedPassword == nil { + if o == nil || IsNil(o.HashedPassword) { return nil, false } return o.HashedPassword, true @@ -58,7 +61,7 @@ func (o *IdentityCredentialsPassword) GetHashedPasswordOk() (*string, bool) { // HasHashedPassword returns a boolean if a field has been set. func (o *IdentityCredentialsPassword) HasHashedPassword() bool { - if o != nil && o.HashedPassword != nil { + if o != nil && !IsNil(o.HashedPassword) { return true } @@ -71,11 +74,19 @@ func (o *IdentityCredentialsPassword) SetHashedPassword(v string) { } func (o IdentityCredentialsPassword) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityCredentialsPassword) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.HashedPassword != nil { + if !IsNil(o.HashedPassword) { toSerialize["hashed_password"] = o.HashedPassword } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityCredentialsPassword struct { diff --git a/internal/httpclient/model_identity_patch.go b/internal/httpclient/model_identity_patch.go index d621e34d458f..596040c0be52 100644 --- a/internal/httpclient/model_identity_patch.go +++ b/internal/httpclient/model_identity_patch.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityPatch{} + // IdentityPatch Payload for patching an identity type IdentityPatch struct { Create *CreateIdentityBody `json:"create,omitempty"` @@ -41,7 +44,7 @@ func NewIdentityPatchWithDefaults() *IdentityPatch { // GetCreate returns the Create field value if set, zero value otherwise. func (o *IdentityPatch) GetCreate() CreateIdentityBody { - if o == nil || o.Create == nil { + if o == nil || IsNil(o.Create) { var ret CreateIdentityBody return ret } @@ -51,7 +54,7 @@ func (o *IdentityPatch) GetCreate() CreateIdentityBody { // GetCreateOk returns a tuple with the Create field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityPatch) GetCreateOk() (*CreateIdentityBody, bool) { - if o == nil || o.Create == nil { + if o == nil || IsNil(o.Create) { return nil, false } return o.Create, true @@ -59,7 +62,7 @@ func (o *IdentityPatch) GetCreateOk() (*CreateIdentityBody, bool) { // HasCreate returns a boolean if a field has been set. func (o *IdentityPatch) HasCreate() bool { - if o != nil && o.Create != nil { + if o != nil && !IsNil(o.Create) { return true } @@ -73,7 +76,7 @@ func (o *IdentityPatch) SetCreate(v CreateIdentityBody) { // GetPatchId returns the PatchId field value if set, zero value otherwise. func (o *IdentityPatch) GetPatchId() string { - if o == nil || o.PatchId == nil { + if o == nil || IsNil(o.PatchId) { var ret string return ret } @@ -83,7 +86,7 @@ func (o *IdentityPatch) GetPatchId() string { // GetPatchIdOk returns a tuple with the PatchId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityPatch) GetPatchIdOk() (*string, bool) { - if o == nil || o.PatchId == nil { + if o == nil || IsNil(o.PatchId) { return nil, false } return o.PatchId, true @@ -91,7 +94,7 @@ func (o *IdentityPatch) GetPatchIdOk() (*string, bool) { // HasPatchId returns a boolean if a field has been set. func (o *IdentityPatch) HasPatchId() bool { - if o != nil && o.PatchId != nil { + if o != nil && !IsNil(o.PatchId) { return true } @@ -104,14 +107,22 @@ func (o *IdentityPatch) SetPatchId(v string) { } func (o IdentityPatch) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityPatch) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Create != nil { + if !IsNil(o.Create) { toSerialize["create"] = o.Create } - if o.PatchId != nil { + if !IsNil(o.PatchId) { toSerialize["patch_id"] = o.PatchId } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityPatch struct { diff --git a/internal/httpclient/model_identity_patch_response.go b/internal/httpclient/model_identity_patch_response.go index 2ee305f7da81..9021de0f405c 100644 --- a/internal/httpclient/model_identity_patch_response.go +++ b/internal/httpclient/model_identity_patch_response.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityPatchResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityPatchResponse{} + // IdentityPatchResponse Response for a single identity patch type IdentityPatchResponse struct { // The action for this specific patch create ActionCreate Create this identity. @@ -44,7 +47,7 @@ func NewIdentityPatchResponseWithDefaults() *IdentityPatchResponse { // GetAction returns the Action field value if set, zero value otherwise. func (o *IdentityPatchResponse) GetAction() string { - if o == nil || o.Action == nil { + if o == nil || IsNil(o.Action) { var ret string return ret } @@ -54,7 +57,7 @@ func (o *IdentityPatchResponse) GetAction() string { // GetActionOk returns a tuple with the Action field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityPatchResponse) GetActionOk() (*string, bool) { - if o == nil || o.Action == nil { + if o == nil || IsNil(o.Action) { return nil, false } return o.Action, true @@ -62,7 +65,7 @@ func (o *IdentityPatchResponse) GetActionOk() (*string, bool) { // HasAction returns a boolean if a field has been set. func (o *IdentityPatchResponse) HasAction() bool { - if o != nil && o.Action != nil { + if o != nil && !IsNil(o.Action) { return true } @@ -76,7 +79,7 @@ func (o *IdentityPatchResponse) SetAction(v string) { // GetIdentity returns the Identity field value if set, zero value otherwise. func (o *IdentityPatchResponse) GetIdentity() string { - if o == nil || o.Identity == nil { + if o == nil || IsNil(o.Identity) { var ret string return ret } @@ -86,7 +89,7 @@ func (o *IdentityPatchResponse) GetIdentity() string { // GetIdentityOk returns a tuple with the Identity field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityPatchResponse) GetIdentityOk() (*string, bool) { - if o == nil || o.Identity == nil { + if o == nil || IsNil(o.Identity) { return nil, false } return o.Identity, true @@ -94,7 +97,7 @@ func (o *IdentityPatchResponse) GetIdentityOk() (*string, bool) { // HasIdentity returns a boolean if a field has been set. func (o *IdentityPatchResponse) HasIdentity() bool { - if o != nil && o.Identity != nil { + if o != nil && !IsNil(o.Identity) { return true } @@ -108,7 +111,7 @@ func (o *IdentityPatchResponse) SetIdentity(v string) { // GetPatchId returns the PatchId field value if set, zero value otherwise. func (o *IdentityPatchResponse) GetPatchId() string { - if o == nil || o.PatchId == nil { + if o == nil || IsNil(o.PatchId) { var ret string return ret } @@ -118,7 +121,7 @@ func (o *IdentityPatchResponse) GetPatchId() string { // GetPatchIdOk returns a tuple with the PatchId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityPatchResponse) GetPatchIdOk() (*string, bool) { - if o == nil || o.PatchId == nil { + if o == nil || IsNil(o.PatchId) { return nil, false } return o.PatchId, true @@ -126,7 +129,7 @@ func (o *IdentityPatchResponse) GetPatchIdOk() (*string, bool) { // HasPatchId returns a boolean if a field has been set. func (o *IdentityPatchResponse) HasPatchId() bool { - if o != nil && o.PatchId != nil { + if o != nil && !IsNil(o.PatchId) { return true } @@ -139,17 +142,25 @@ func (o *IdentityPatchResponse) SetPatchId(v string) { } func (o IdentityPatchResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityPatchResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Action != nil { + if !IsNil(o.Action) { toSerialize["action"] = o.Action } - if o.Identity != nil { + if !IsNil(o.Identity) { toSerialize["identity"] = o.Identity } - if o.PatchId != nil { + if !IsNil(o.PatchId) { toSerialize["patch_id"] = o.PatchId } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityPatchResponse struct { diff --git a/internal/httpclient/model_identity_schema_container.go b/internal/httpclient/model_identity_schema_container.go index d25bd30ab716..331f4662f20b 100644 --- a/internal/httpclient/model_identity_schema_container.go +++ b/internal/httpclient/model_identity_schema_container.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentitySchemaContainer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentitySchemaContainer{} + // IdentitySchemaContainer An Identity JSON Schema Container type IdentitySchemaContainer struct { // The ID of the Identity JSON Schema @@ -42,7 +45,7 @@ func NewIdentitySchemaContainerWithDefaults() *IdentitySchemaContainer { // GetId returns the Id field value if set, zero value otherwise. func (o *IdentitySchemaContainer) GetId() string { - if o == nil || o.Id == nil { + if o == nil || IsNil(o.Id) { var ret string return ret } @@ -52,7 +55,7 @@ func (o *IdentitySchemaContainer) GetId() string { // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentitySchemaContainer) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { + if o == nil || IsNil(o.Id) { return nil, false } return o.Id, true @@ -60,7 +63,7 @@ func (o *IdentitySchemaContainer) GetIdOk() (*string, bool) { // HasId returns a boolean if a field has been set. func (o *IdentitySchemaContainer) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } @@ -74,7 +77,7 @@ func (o *IdentitySchemaContainer) SetId(v string) { // GetSchema returns the Schema field value if set, zero value otherwise. func (o *IdentitySchemaContainer) GetSchema() map[string]interface{} { - if o == nil || o.Schema == nil { + if o == nil || IsNil(o.Schema) { var ret map[string]interface{} return ret } @@ -84,15 +87,15 @@ func (o *IdentitySchemaContainer) GetSchema() map[string]interface{} { // GetSchemaOk returns a tuple with the Schema field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentitySchemaContainer) GetSchemaOk() (map[string]interface{}, bool) { - if o == nil || o.Schema == nil { - return nil, false + if o == nil || IsNil(o.Schema) { + return map[string]interface{}{}, false } return o.Schema, true } // HasSchema returns a boolean if a field has been set. func (o *IdentitySchemaContainer) HasSchema() bool { - if o != nil && o.Schema != nil { + if o != nil && !IsNil(o.Schema) { return true } @@ -105,14 +108,22 @@ func (o *IdentitySchemaContainer) SetSchema(v map[string]interface{}) { } func (o IdentitySchemaContainer) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentitySchemaContainer) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - if o.Schema != nil { + if !IsNil(o.Schema) { toSerialize["schema"] = o.Schema } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentitySchemaContainer struct { diff --git a/internal/httpclient/model_identity_with_credentials.go b/internal/httpclient/model_identity_with_credentials.go index 74e0d2651633..66645005e9fa 100644 --- a/internal/httpclient/model_identity_with_credentials.go +++ b/internal/httpclient/model_identity_with_credentials.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityWithCredentials type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityWithCredentials{} + // IdentityWithCredentials Create Identity and Import Credentials type IdentityWithCredentials struct { Oidc *IdentityWithCredentialsOidc `json:"oidc,omitempty"` @@ -40,7 +43,7 @@ func NewIdentityWithCredentialsWithDefaults() *IdentityWithCredentials { // GetOidc returns the Oidc field value if set, zero value otherwise. func (o *IdentityWithCredentials) GetOidc() IdentityWithCredentialsOidc { - if o == nil || o.Oidc == nil { + if o == nil || IsNil(o.Oidc) { var ret IdentityWithCredentialsOidc return ret } @@ -50,7 +53,7 @@ func (o *IdentityWithCredentials) GetOidc() IdentityWithCredentialsOidc { // GetOidcOk returns a tuple with the Oidc field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentials) GetOidcOk() (*IdentityWithCredentialsOidc, bool) { - if o == nil || o.Oidc == nil { + if o == nil || IsNil(o.Oidc) { return nil, false } return o.Oidc, true @@ -58,7 +61,7 @@ func (o *IdentityWithCredentials) GetOidcOk() (*IdentityWithCredentialsOidc, boo // HasOidc returns a boolean if a field has been set. func (o *IdentityWithCredentials) HasOidc() bool { - if o != nil && o.Oidc != nil { + if o != nil && !IsNil(o.Oidc) { return true } @@ -72,7 +75,7 @@ func (o *IdentityWithCredentials) SetOidc(v IdentityWithCredentialsOidc) { // GetPassword returns the Password field value if set, zero value otherwise. func (o *IdentityWithCredentials) GetPassword() IdentityWithCredentialsPassword { - if o == nil || o.Password == nil { + if o == nil || IsNil(o.Password) { var ret IdentityWithCredentialsPassword return ret } @@ -82,7 +85,7 @@ func (o *IdentityWithCredentials) GetPassword() IdentityWithCredentialsPassword // GetPasswordOk returns a tuple with the Password field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentials) GetPasswordOk() (*IdentityWithCredentialsPassword, bool) { - if o == nil || o.Password == nil { + if o == nil || IsNil(o.Password) { return nil, false } return o.Password, true @@ -90,7 +93,7 @@ func (o *IdentityWithCredentials) GetPasswordOk() (*IdentityWithCredentialsPassw // HasPassword returns a boolean if a field has been set. func (o *IdentityWithCredentials) HasPassword() bool { - if o != nil && o.Password != nil { + if o != nil && !IsNil(o.Password) { return true } @@ -103,14 +106,22 @@ func (o *IdentityWithCredentials) SetPassword(v IdentityWithCredentialsPassword) } func (o IdentityWithCredentials) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityWithCredentials) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Oidc != nil { + if !IsNil(o.Oidc) { toSerialize["oidc"] = o.Oidc } - if o.Password != nil { + if !IsNil(o.Password) { toSerialize["password"] = o.Password } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityWithCredentials struct { diff --git a/internal/httpclient/model_identity_with_credentials_oidc.go b/internal/httpclient/model_identity_with_credentials_oidc.go index afa70faa97e0..ee6fd86225d1 100644 --- a/internal/httpclient/model_identity_with_credentials_oidc.go +++ b/internal/httpclient/model_identity_with_credentials_oidc.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityWithCredentialsOidc type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityWithCredentialsOidc{} + // IdentityWithCredentialsOidc Create Identity and Import Social Sign In Credentials type IdentityWithCredentialsOidc struct { Config *IdentityWithCredentialsOidcConfig `json:"config,omitempty"` @@ -39,7 +42,7 @@ func NewIdentityWithCredentialsOidcWithDefaults() *IdentityWithCredentialsOidc { // GetConfig returns the Config field value if set, zero value otherwise. func (o *IdentityWithCredentialsOidc) GetConfig() IdentityWithCredentialsOidcConfig { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { var ret IdentityWithCredentialsOidcConfig return ret } @@ -49,7 +52,7 @@ func (o *IdentityWithCredentialsOidc) GetConfig() IdentityWithCredentialsOidcCon // GetConfigOk returns a tuple with the Config field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentialsOidc) GetConfigOk() (*IdentityWithCredentialsOidcConfig, bool) { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { return nil, false } return o.Config, true @@ -57,7 +60,7 @@ func (o *IdentityWithCredentialsOidc) GetConfigOk() (*IdentityWithCredentialsOid // HasConfig returns a boolean if a field has been set. func (o *IdentityWithCredentialsOidc) HasConfig() bool { - if o != nil && o.Config != nil { + if o != nil && !IsNil(o.Config) { return true } @@ -70,11 +73,19 @@ func (o *IdentityWithCredentialsOidc) SetConfig(v IdentityWithCredentialsOidcCon } func (o IdentityWithCredentialsOidc) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityWithCredentialsOidc) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Config != nil { + if !IsNil(o.Config) { toSerialize["config"] = o.Config } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityWithCredentialsOidc struct { diff --git a/internal/httpclient/model_identity_with_credentials_oidc_config.go b/internal/httpclient/model_identity_with_credentials_oidc_config.go index 51440cb44092..abec0e301538 100644 --- a/internal/httpclient/model_identity_with_credentials_oidc_config.go +++ b/internal/httpclient/model_identity_with_credentials_oidc_config.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityWithCredentialsOidcConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityWithCredentialsOidcConfig{} + // IdentityWithCredentialsOidcConfig struct for IdentityWithCredentialsOidcConfig type IdentityWithCredentialsOidcConfig struct { Config *IdentityWithCredentialsPasswordConfig `json:"config,omitempty"` @@ -41,7 +44,7 @@ func NewIdentityWithCredentialsOidcConfigWithDefaults() *IdentityWithCredentials // GetConfig returns the Config field value if set, zero value otherwise. func (o *IdentityWithCredentialsOidcConfig) GetConfig() IdentityWithCredentialsPasswordConfig { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { var ret IdentityWithCredentialsPasswordConfig return ret } @@ -51,7 +54,7 @@ func (o *IdentityWithCredentialsOidcConfig) GetConfig() IdentityWithCredentialsP // GetConfigOk returns a tuple with the Config field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentialsOidcConfig) GetConfigOk() (*IdentityWithCredentialsPasswordConfig, bool) { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { return nil, false } return o.Config, true @@ -59,7 +62,7 @@ func (o *IdentityWithCredentialsOidcConfig) GetConfigOk() (*IdentityWithCredenti // HasConfig returns a boolean if a field has been set. func (o *IdentityWithCredentialsOidcConfig) HasConfig() bool { - if o != nil && o.Config != nil { + if o != nil && !IsNil(o.Config) { return true } @@ -73,7 +76,7 @@ func (o *IdentityWithCredentialsOidcConfig) SetConfig(v IdentityWithCredentialsP // GetProviders returns the Providers field value if set, zero value otherwise. func (o *IdentityWithCredentialsOidcConfig) GetProviders() []IdentityWithCredentialsOidcConfigProvider { - if o == nil || o.Providers == nil { + if o == nil || IsNil(o.Providers) { var ret []IdentityWithCredentialsOidcConfigProvider return ret } @@ -83,7 +86,7 @@ func (o *IdentityWithCredentialsOidcConfig) GetProviders() []IdentityWithCredent // GetProvidersOk returns a tuple with the Providers field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentialsOidcConfig) GetProvidersOk() ([]IdentityWithCredentialsOidcConfigProvider, bool) { - if o == nil || o.Providers == nil { + if o == nil || IsNil(o.Providers) { return nil, false } return o.Providers, true @@ -91,7 +94,7 @@ func (o *IdentityWithCredentialsOidcConfig) GetProvidersOk() ([]IdentityWithCred // HasProviders returns a boolean if a field has been set. func (o *IdentityWithCredentialsOidcConfig) HasProviders() bool { - if o != nil && o.Providers != nil { + if o != nil && !IsNil(o.Providers) { return true } @@ -104,14 +107,22 @@ func (o *IdentityWithCredentialsOidcConfig) SetProviders(v []IdentityWithCredent } func (o IdentityWithCredentialsOidcConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityWithCredentialsOidcConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Config != nil { + if !IsNil(o.Config) { toSerialize["config"] = o.Config } - if o.Providers != nil { + if !IsNil(o.Providers) { toSerialize["providers"] = o.Providers } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityWithCredentialsOidcConfig struct { diff --git a/internal/httpclient/model_identity_with_credentials_oidc_config_provider.go b/internal/httpclient/model_identity_with_credentials_oidc_config_provider.go index a12405169aef..f2308d8ab376 100644 --- a/internal/httpclient/model_identity_with_credentials_oidc_config_provider.go +++ b/internal/httpclient/model_identity_with_credentials_oidc_config_provider.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the IdentityWithCredentialsOidcConfigProvider type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityWithCredentialsOidcConfigProvider{} + // IdentityWithCredentialsOidcConfigProvider Create Identity and Import Social Sign In Credentials Configuration type IdentityWithCredentialsOidcConfigProvider struct { // The OpenID Connect provider to link the subject to. Usually something like `google` or `github`. @@ -23,6 +28,8 @@ type IdentityWithCredentialsOidcConfigProvider struct { Subject string `json:"subject"` } +type _IdentityWithCredentialsOidcConfigProvider IdentityWithCredentialsOidcConfigProvider + // NewIdentityWithCredentialsOidcConfigProvider instantiates a new IdentityWithCredentialsOidcConfigProvider object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -91,14 +98,56 @@ func (o *IdentityWithCredentialsOidcConfigProvider) SetSubject(v string) { } func (o IdentityWithCredentialsOidcConfigProvider) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityWithCredentialsOidcConfigProvider) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["provider"] = o.Provider + toSerialize["provider"] = o.Provider + toSerialize["subject"] = o.Subject + return toSerialize, nil +} + +func (o *IdentityWithCredentialsOidcConfigProvider) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "provider", + "subject", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["subject"] = o.Subject + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varIdentityWithCredentialsOidcConfigProvider := _IdentityWithCredentialsOidcConfigProvider{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIdentityWithCredentialsOidcConfigProvider) + + if err != nil { + return err + } + + *o = IdentityWithCredentialsOidcConfigProvider(varIdentityWithCredentialsOidcConfigProvider) + + return err } type NullableIdentityWithCredentialsOidcConfigProvider struct { diff --git a/internal/httpclient/model_identity_with_credentials_password.go b/internal/httpclient/model_identity_with_credentials_password.go index ca5a7bd46195..cae6b8dae2d1 100644 --- a/internal/httpclient/model_identity_with_credentials_password.go +++ b/internal/httpclient/model_identity_with_credentials_password.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityWithCredentialsPassword type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityWithCredentialsPassword{} + // IdentityWithCredentialsPassword Create Identity and Import Password Credentials type IdentityWithCredentialsPassword struct { Config *IdentityWithCredentialsPasswordConfig `json:"config,omitempty"` @@ -39,7 +42,7 @@ func NewIdentityWithCredentialsPasswordWithDefaults() *IdentityWithCredentialsPa // GetConfig returns the Config field value if set, zero value otherwise. func (o *IdentityWithCredentialsPassword) GetConfig() IdentityWithCredentialsPasswordConfig { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { var ret IdentityWithCredentialsPasswordConfig return ret } @@ -49,7 +52,7 @@ func (o *IdentityWithCredentialsPassword) GetConfig() IdentityWithCredentialsPas // GetConfigOk returns a tuple with the Config field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentialsPassword) GetConfigOk() (*IdentityWithCredentialsPasswordConfig, bool) { - if o == nil || o.Config == nil { + if o == nil || IsNil(o.Config) { return nil, false } return o.Config, true @@ -57,7 +60,7 @@ func (o *IdentityWithCredentialsPassword) GetConfigOk() (*IdentityWithCredential // HasConfig returns a boolean if a field has been set. func (o *IdentityWithCredentialsPassword) HasConfig() bool { - if o != nil && o.Config != nil { + if o != nil && !IsNil(o.Config) { return true } @@ -70,11 +73,19 @@ func (o *IdentityWithCredentialsPassword) SetConfig(v IdentityWithCredentialsPas } func (o IdentityWithCredentialsPassword) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityWithCredentialsPassword) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Config != nil { + if !IsNil(o.Config) { toSerialize["config"] = o.Config } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityWithCredentialsPassword struct { diff --git a/internal/httpclient/model_identity_with_credentials_password_config.go b/internal/httpclient/model_identity_with_credentials_password_config.go index 754d59460f83..7dd00ae3ea2a 100644 --- a/internal/httpclient/model_identity_with_credentials_password_config.go +++ b/internal/httpclient/model_identity_with_credentials_password_config.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the IdentityWithCredentialsPasswordConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentityWithCredentialsPasswordConfig{} + // IdentityWithCredentialsPasswordConfig Create Identity and Import Password Credentials Configuration type IdentityWithCredentialsPasswordConfig struct { // The hashed password in [PHC format](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities#hashed-passwords) @@ -42,7 +45,7 @@ func NewIdentityWithCredentialsPasswordConfigWithDefaults() *IdentityWithCredent // GetHashedPassword returns the HashedPassword field value if set, zero value otherwise. func (o *IdentityWithCredentialsPasswordConfig) GetHashedPassword() string { - if o == nil || o.HashedPassword == nil { + if o == nil || IsNil(o.HashedPassword) { var ret string return ret } @@ -52,7 +55,7 @@ func (o *IdentityWithCredentialsPasswordConfig) GetHashedPassword() string { // GetHashedPasswordOk returns a tuple with the HashedPassword field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentialsPasswordConfig) GetHashedPasswordOk() (*string, bool) { - if o == nil || o.HashedPassword == nil { + if o == nil || IsNil(o.HashedPassword) { return nil, false } return o.HashedPassword, true @@ -60,7 +63,7 @@ func (o *IdentityWithCredentialsPasswordConfig) GetHashedPasswordOk() (*string, // HasHashedPassword returns a boolean if a field has been set. func (o *IdentityWithCredentialsPasswordConfig) HasHashedPassword() bool { - if o != nil && o.HashedPassword != nil { + if o != nil && !IsNil(o.HashedPassword) { return true } @@ -74,7 +77,7 @@ func (o *IdentityWithCredentialsPasswordConfig) SetHashedPassword(v string) { // GetPassword returns the Password field value if set, zero value otherwise. func (o *IdentityWithCredentialsPasswordConfig) GetPassword() string { - if o == nil || o.Password == nil { + if o == nil || IsNil(o.Password) { var ret string return ret } @@ -84,7 +87,7 @@ func (o *IdentityWithCredentialsPasswordConfig) GetPassword() string { // GetPasswordOk returns a tuple with the Password field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IdentityWithCredentialsPasswordConfig) GetPasswordOk() (*string, bool) { - if o == nil || o.Password == nil { + if o == nil || IsNil(o.Password) { return nil, false } return o.Password, true @@ -92,7 +95,7 @@ func (o *IdentityWithCredentialsPasswordConfig) GetPasswordOk() (*string, bool) // HasPassword returns a boolean if a field has been set. func (o *IdentityWithCredentialsPasswordConfig) HasPassword() bool { - if o != nil && o.Password != nil { + if o != nil && !IsNil(o.Password) { return true } @@ -105,14 +108,22 @@ func (o *IdentityWithCredentialsPasswordConfig) SetPassword(v string) { } func (o IdentityWithCredentialsPasswordConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentityWithCredentialsPasswordConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.HashedPassword != nil { + if !IsNil(o.HashedPassword) { toSerialize["hashed_password"] = o.HashedPassword } - if o.Password != nil { + if !IsNil(o.Password) { toSerialize["password"] = o.Password } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIdentityWithCredentialsPasswordConfig struct { diff --git a/internal/httpclient/model_is_alive_200_response.go b/internal/httpclient/model_is_alive_200_response.go index cce2dfa5238f..76b0cf00f301 100644 --- a/internal/httpclient/model_is_alive_200_response.go +++ b/internal/httpclient/model_is_alive_200_response.go @@ -1,26 +1,33 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the IsAlive200Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IsAlive200Response{} + // IsAlive200Response struct for IsAlive200Response type IsAlive200Response struct { // Always \"ok\". Status string `json:"status"` } +type _IsAlive200Response IsAlive200Response + // NewIsAlive200Response instantiates a new IsAlive200Response object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -64,13 +71,56 @@ func (o *IsAlive200Response) SetStatus(v string) { } func (o IsAlive200Response) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["status"] = o.Status + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } return json.Marshal(toSerialize) } +func (o IsAlive200Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["status"] = o.Status + return toSerialize, nil +} + +func (o *IsAlive200Response) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIsAlive200Response := _IsAlive200Response{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIsAlive200Response) + + if err != nil { + return err + } + + *o = IsAlive200Response(varIsAlive200Response) + + return err +} + type NullableIsAlive200Response struct { value *IsAlive200Response isSet bool diff --git a/internal/httpclient/model_is_ready_503_response.go b/internal/httpclient/model_is_ready_503_response.go index 9b0b6f581a25..b7779f278a98 100644 --- a/internal/httpclient/model_is_ready_503_response.go +++ b/internal/httpclient/model_is_ready_503_response.go @@ -1,26 +1,33 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the IsReady503Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IsReady503Response{} + // IsReady503Response struct for IsReady503Response type IsReady503Response struct { // Errors contains a list of errors that caused the not ready status. Errors map[string]string `json:"errors"` } +type _IsReady503Response IsReady503Response + // NewIsReady503Response instantiates a new IsReady503Response object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -64,13 +71,56 @@ func (o *IsReady503Response) SetErrors(v map[string]string) { } func (o IsReady503Response) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["errors"] = o.Errors + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } return json.Marshal(toSerialize) } +func (o IsReady503Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["errors"] = o.Errors + return toSerialize, nil +} + +func (o *IsReady503Response) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "errors", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIsReady503Response := _IsReady503Response{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIsReady503Response) + + if err != nil { + return err + } + + *o = IsReady503Response(varIsReady503Response) + + return err +} + type NullableIsReady503Response struct { value *IsReady503Response isSet bool diff --git a/internal/httpclient/model_json_patch.go b/internal/httpclient/model_json_patch.go index b810d0ef4a74..e2cdb8a4dece 100644 --- a/internal/httpclient/model_json_patch.go +++ b/internal/httpclient/model_json_patch.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the JsonPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &JsonPatch{} + // JsonPatch A JSONPatch document as defined by RFC 6902 type JsonPatch struct { // This field is used together with operation \"move\" and uses JSON Pointer notation. Learn more [about JSON Pointers](https://datatracker.ietf.org/doc/html/rfc6901#section-5). @@ -27,6 +32,8 @@ type JsonPatch struct { Value interface{} `json:"value,omitempty"` } +type _JsonPatch JsonPatch + // NewJsonPatch instantiates a new JsonPatch object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -48,7 +55,7 @@ func NewJsonPatchWithDefaults() *JsonPatch { // GetFrom returns the From field value if set, zero value otherwise. func (o *JsonPatch) GetFrom() string { - if o == nil || o.From == nil { + if o == nil || IsNil(o.From) { var ret string return ret } @@ -58,7 +65,7 @@ func (o *JsonPatch) GetFrom() string { // GetFromOk returns a tuple with the From field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *JsonPatch) GetFromOk() (*string, bool) { - if o == nil || o.From == nil { + if o == nil || IsNil(o.From) { return nil, false } return o.From, true @@ -66,7 +73,7 @@ func (o *JsonPatch) GetFromOk() (*string, bool) { // HasFrom returns a boolean if a field has been set. func (o *JsonPatch) HasFrom() bool { - if o != nil && o.From != nil { + if o != nil && !IsNil(o.From) { return true } @@ -139,7 +146,7 @@ func (o *JsonPatch) GetValue() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *JsonPatch) GetValueOk() (*interface{}, bool) { - if o == nil || o.Value == nil { + if o == nil || IsNil(o.Value) { return nil, false } return &o.Value, true @@ -147,7 +154,7 @@ func (o *JsonPatch) GetValueOk() (*interface{}, bool) { // HasValue returns a boolean if a field has been set. func (o *JsonPatch) HasValue() bool { - if o != nil && o.Value != nil { + if o != nil && IsNil(o.Value) { return true } @@ -160,20 +167,62 @@ func (o *JsonPatch) SetValue(v interface{}) { } func (o JsonPatch) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o JsonPatch) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.From != nil { + if !IsNil(o.From) { toSerialize["from"] = o.From } - if true { - toSerialize["op"] = o.Op - } - if true { - toSerialize["path"] = o.Path - } + toSerialize["op"] = o.Op + toSerialize["path"] = o.Path if o.Value != nil { toSerialize["value"] = o.Value } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *JsonPatch) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "op", + "path", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varJsonPatch := _JsonPatch{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varJsonPatch) + + if err != nil { + return err + } + + *o = JsonPatch(varJsonPatch) + + return err } type NullableJsonPatch struct { diff --git a/internal/httpclient/model_login_flow.go b/internal/httpclient/model_login_flow.go index b36abc379568..579ac16e27e9 100644 --- a/internal/httpclient/model_login_flow.go +++ b/internal/httpclient/model_login_flow.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the LoginFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoginFlow{} + // LoginFlow This object represents a login flow. A login flow is initiated at the \"Initiate Login API / Browser Flow\" endpoint by a client. Once a login flow is completed successfully, a session cookie or session token will be issued. type LoginFlow struct { // The active login method If set contains the login method used. If the flow is new, it is unset. password CredentialsTypePassword oidc CredentialsTypeOIDC totp CredentialsTypeTOTP lookup_secret CredentialsTypeLookup webauthn CredentialsTypeWebAuthn code CredentialsTypeCodeAuth link_recovery CredentialsTypeRecoveryLink CredentialsTypeRecoveryLink is a special credential type linked to the link strategy (recovery flow). It is not used within the credentials object itself. code_recovery CredentialsTypeRecoveryCode @@ -50,6 +55,8 @@ type LoginFlow struct { UpdatedAt *time.Time `json:"updated_at,omitempty"` } +type _LoginFlow LoginFlow + // NewLoginFlow instantiates a new LoginFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -76,7 +83,7 @@ func NewLoginFlowWithDefaults() *LoginFlow { // GetActive returns the Active field value if set, zero value otherwise. func (o *LoginFlow) GetActive() string { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { var ret string return ret } @@ -86,7 +93,7 @@ func (o *LoginFlow) GetActive() string { // GetActiveOk returns a tuple with the Active field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetActiveOk() (*string, bool) { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { return nil, false } return o.Active, true @@ -94,7 +101,7 @@ func (o *LoginFlow) GetActiveOk() (*string, bool) { // HasActive returns a boolean if a field has been set. func (o *LoginFlow) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } @@ -108,7 +115,7 @@ func (o *LoginFlow) SetActive(v string) { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *LoginFlow) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -118,7 +125,7 @@ func (o *LoginFlow) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -126,7 +133,7 @@ func (o *LoginFlow) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *LoginFlow) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -212,7 +219,7 @@ func (o *LoginFlow) SetIssuedAt(v time.Time) { // GetOauth2LoginChallenge returns the Oauth2LoginChallenge field value if set, zero value otherwise. func (o *LoginFlow) GetOauth2LoginChallenge() string { - if o == nil || o.Oauth2LoginChallenge == nil { + if o == nil || IsNil(o.Oauth2LoginChallenge) { var ret string return ret } @@ -222,7 +229,7 @@ func (o *LoginFlow) GetOauth2LoginChallenge() string { // GetOauth2LoginChallengeOk returns a tuple with the Oauth2LoginChallenge field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetOauth2LoginChallengeOk() (*string, bool) { - if o == nil || o.Oauth2LoginChallenge == nil { + if o == nil || IsNil(o.Oauth2LoginChallenge) { return nil, false } return o.Oauth2LoginChallenge, true @@ -230,7 +237,7 @@ func (o *LoginFlow) GetOauth2LoginChallengeOk() (*string, bool) { // HasOauth2LoginChallenge returns a boolean if a field has been set. func (o *LoginFlow) HasOauth2LoginChallenge() bool { - if o != nil && o.Oauth2LoginChallenge != nil { + if o != nil && !IsNil(o.Oauth2LoginChallenge) { return true } @@ -244,7 +251,7 @@ func (o *LoginFlow) SetOauth2LoginChallenge(v string) { // GetOauth2LoginRequest returns the Oauth2LoginRequest field value if set, zero value otherwise. func (o *LoginFlow) GetOauth2LoginRequest() OAuth2LoginRequest { - if o == nil || o.Oauth2LoginRequest == nil { + if o == nil || IsNil(o.Oauth2LoginRequest) { var ret OAuth2LoginRequest return ret } @@ -254,7 +261,7 @@ func (o *LoginFlow) GetOauth2LoginRequest() OAuth2LoginRequest { // GetOauth2LoginRequestOk returns a tuple with the Oauth2LoginRequest field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetOauth2LoginRequestOk() (*OAuth2LoginRequest, bool) { - if o == nil || o.Oauth2LoginRequest == nil { + if o == nil || IsNil(o.Oauth2LoginRequest) { return nil, false } return o.Oauth2LoginRequest, true @@ -262,7 +269,7 @@ func (o *LoginFlow) GetOauth2LoginRequestOk() (*OAuth2LoginRequest, bool) { // HasOauth2LoginRequest returns a boolean if a field has been set. func (o *LoginFlow) HasOauth2LoginRequest() bool { - if o != nil && o.Oauth2LoginRequest != nil { + if o != nil && !IsNil(o.Oauth2LoginRequest) { return true } @@ -276,7 +283,7 @@ func (o *LoginFlow) SetOauth2LoginRequest(v OAuth2LoginRequest) { // GetOrganizationId returns the OrganizationId field value if set, zero value otherwise (both if not set or set to explicit null). func (o *LoginFlow) GetOrganizationId() string { - if o == nil || o.OrganizationId.Get() == nil { + if o == nil || IsNil(o.OrganizationId.Get()) { var ret string return ret } @@ -319,7 +326,7 @@ func (o *LoginFlow) UnsetOrganizationId() { // GetRefresh returns the Refresh field value if set, zero value otherwise. func (o *LoginFlow) GetRefresh() bool { - if o == nil || o.Refresh == nil { + if o == nil || IsNil(o.Refresh) { var ret bool return ret } @@ -329,7 +336,7 @@ func (o *LoginFlow) GetRefresh() bool { // GetRefreshOk returns a tuple with the Refresh field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetRefreshOk() (*bool, bool) { - if o == nil || o.Refresh == nil { + if o == nil || IsNil(o.Refresh) { return nil, false } return o.Refresh, true @@ -337,7 +344,7 @@ func (o *LoginFlow) GetRefreshOk() (*bool, bool) { // HasRefresh returns a boolean if a field has been set. func (o *LoginFlow) HasRefresh() bool { - if o != nil && o.Refresh != nil { + if o != nil && !IsNil(o.Refresh) { return true } @@ -375,7 +382,7 @@ func (o *LoginFlow) SetRequestUrl(v string) { // GetRequestedAal returns the RequestedAal field value if set, zero value otherwise. func (o *LoginFlow) GetRequestedAal() AuthenticatorAssuranceLevel { - if o == nil || o.RequestedAal == nil { + if o == nil || IsNil(o.RequestedAal) { var ret AuthenticatorAssuranceLevel return ret } @@ -385,7 +392,7 @@ func (o *LoginFlow) GetRequestedAal() AuthenticatorAssuranceLevel { // GetRequestedAalOk returns a tuple with the RequestedAal field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetRequestedAalOk() (*AuthenticatorAssuranceLevel, bool) { - if o == nil || o.RequestedAal == nil { + if o == nil || IsNil(o.RequestedAal) { return nil, false } return o.RequestedAal, true @@ -393,7 +400,7 @@ func (o *LoginFlow) GetRequestedAalOk() (*AuthenticatorAssuranceLevel, bool) { // HasRequestedAal returns a boolean if a field has been set. func (o *LoginFlow) HasRequestedAal() bool { - if o != nil && o.RequestedAal != nil { + if o != nil && !IsNil(o.RequestedAal) { return true } @@ -407,7 +414,7 @@ func (o *LoginFlow) SetRequestedAal(v AuthenticatorAssuranceLevel) { // GetReturnTo returns the ReturnTo field value if set, zero value otherwise. func (o *LoginFlow) GetReturnTo() string { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { var ret string return ret } @@ -417,7 +424,7 @@ func (o *LoginFlow) GetReturnTo() string { // GetReturnToOk returns a tuple with the ReturnTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetReturnToOk() (*string, bool) { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { return nil, false } return o.ReturnTo, true @@ -425,7 +432,7 @@ func (o *LoginFlow) GetReturnToOk() (*string, bool) { // HasReturnTo returns a boolean if a field has been set. func (o *LoginFlow) HasReturnTo() bool { - if o != nil && o.ReturnTo != nil { + if o != nil && !IsNil(o.ReturnTo) { return true } @@ -439,7 +446,7 @@ func (o *LoginFlow) SetReturnTo(v string) { // GetSessionTokenExchangeCode returns the SessionTokenExchangeCode field value if set, zero value otherwise. func (o *LoginFlow) GetSessionTokenExchangeCode() string { - if o == nil || o.SessionTokenExchangeCode == nil { + if o == nil || IsNil(o.SessionTokenExchangeCode) { var ret string return ret } @@ -449,7 +456,7 @@ func (o *LoginFlow) GetSessionTokenExchangeCode() string { // GetSessionTokenExchangeCodeOk returns a tuple with the SessionTokenExchangeCode field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetSessionTokenExchangeCodeOk() (*string, bool) { - if o == nil || o.SessionTokenExchangeCode == nil { + if o == nil || IsNil(o.SessionTokenExchangeCode) { return nil, false } return o.SessionTokenExchangeCode, true @@ -457,7 +464,7 @@ func (o *LoginFlow) GetSessionTokenExchangeCodeOk() (*string, bool) { // HasSessionTokenExchangeCode returns a boolean if a field has been set. func (o *LoginFlow) HasSessionTokenExchangeCode() bool { - if o != nil && o.SessionTokenExchangeCode != nil { + if o != nil && !IsNil(o.SessionTokenExchangeCode) { return true } @@ -484,7 +491,7 @@ func (o *LoginFlow) GetState() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *LoginFlow) GetStateOk() (*interface{}, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return &o.State, true @@ -545,7 +552,7 @@ func (o *LoginFlow) SetUi(v UiContainer) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *LoginFlow) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -555,7 +562,7 @@ func (o *LoginFlow) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *LoginFlow) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -563,7 +570,7 @@ func (o *LoginFlow) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *LoginFlow) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -576,59 +583,98 @@ func (o *LoginFlow) SetUpdatedAt(v time.Time) { } func (o LoginFlow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LoginFlow) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if true { - toSerialize["expires_at"] = o.ExpiresAt - } - if true { - toSerialize["id"] = o.Id - } - if true { - toSerialize["issued_at"] = o.IssuedAt - } - if o.Oauth2LoginChallenge != nil { + toSerialize["expires_at"] = o.ExpiresAt + toSerialize["id"] = o.Id + toSerialize["issued_at"] = o.IssuedAt + if !IsNil(o.Oauth2LoginChallenge) { toSerialize["oauth2_login_challenge"] = o.Oauth2LoginChallenge } - if o.Oauth2LoginRequest != nil { + if !IsNil(o.Oauth2LoginRequest) { toSerialize["oauth2_login_request"] = o.Oauth2LoginRequest } if o.OrganizationId.IsSet() { toSerialize["organization_id"] = o.OrganizationId.Get() } - if o.Refresh != nil { + if !IsNil(o.Refresh) { toSerialize["refresh"] = o.Refresh } - if true { - toSerialize["request_url"] = o.RequestUrl - } - if o.RequestedAal != nil { + toSerialize["request_url"] = o.RequestUrl + if !IsNil(o.RequestedAal) { toSerialize["requested_aal"] = o.RequestedAal } - if o.ReturnTo != nil { + if !IsNil(o.ReturnTo) { toSerialize["return_to"] = o.ReturnTo } - if o.SessionTokenExchangeCode != nil { + if !IsNil(o.SessionTokenExchangeCode) { toSerialize["session_token_exchange_code"] = o.SessionTokenExchangeCode } if o.State != nil { toSerialize["state"] = o.State } - if true { - toSerialize["type"] = o.Type + toSerialize["type"] = o.Type + toSerialize["ui"] = o.Ui + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + return toSerialize, nil +} + +func (o *LoginFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "expires_at", + "id", + "issued_at", + "request_url", + "state", + "type", + "ui", } - if true { - toSerialize["ui"] = o.Ui + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if o.UpdatedAt != nil { - toSerialize["updated_at"] = o.UpdatedAt + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varLoginFlow := _LoginFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varLoginFlow) + + if err != nil { + return err + } + + *o = LoginFlow(varLoginFlow) + + return err } type NullableLoginFlow struct { diff --git a/internal/httpclient/model_login_flow_state.go b/internal/httpclient/model_login_flow_state.go index ce5570b79032..93b41b4708d8 100644 --- a/internal/httpclient/model_login_flow_state.go +++ b/internal/httpclient/model_login_flow_state.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -26,6 +26,13 @@ const ( LOGINFLOWSTATE_PASSED_CHALLENGE LoginFlowState = "passed_challenge" ) +// All allowed values of LoginFlowState enum +var AllowedLoginFlowStateEnumValues = []LoginFlowState{ + "choose_method", + "sent_email", + "passed_challenge", +} + func (v *LoginFlowState) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -33,7 +40,7 @@ func (v *LoginFlowState) UnmarshalJSON(src []byte) error { return err } enumTypeValue := LoginFlowState(value) - for _, existing := range []LoginFlowState{"choose_method", "sent_email", "passed_challenge"} { + for _, existing := range AllowedLoginFlowStateEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -43,6 +50,27 @@ func (v *LoginFlowState) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid LoginFlowState", value) } +// NewLoginFlowStateFromValue returns a pointer to a valid LoginFlowState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLoginFlowStateFromValue(v string) (*LoginFlowState, error) { + ev := LoginFlowState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LoginFlowState: valid values are %v", v, AllowedLoginFlowStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LoginFlowState) IsValid() bool { + for _, existing := range AllowedLoginFlowStateEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to loginFlowState value func (v LoginFlowState) Ptr() *LoginFlowState { return &v diff --git a/internal/httpclient/model_logout_flow.go b/internal/httpclient/model_logout_flow.go index 63c339b4febd..14ea2b117a38 100644 --- a/internal/httpclient/model_logout_flow.go +++ b/internal/httpclient/model_logout_flow.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the LogoutFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LogoutFlow{} + // LogoutFlow Logout Flow type LogoutFlow struct { // LogoutToken can be used to perform logout using AJAX. @@ -23,6 +28,8 @@ type LogoutFlow struct { LogoutUrl string `json:"logout_url"` } +type _LogoutFlow LogoutFlow + // NewLogoutFlow instantiates a new LogoutFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -91,14 +98,56 @@ func (o *LogoutFlow) SetLogoutUrl(v string) { } func (o LogoutFlow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LogoutFlow) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["logout_token"] = o.LogoutToken + toSerialize["logout_token"] = o.LogoutToken + toSerialize["logout_url"] = o.LogoutUrl + return toSerialize, nil +} + +func (o *LogoutFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "logout_token", + "logout_url", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["logout_url"] = o.LogoutUrl + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varLogoutFlow := _LogoutFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varLogoutFlow) + + if err != nil { + return err + } + + *o = LogoutFlow(varLogoutFlow) + + return err } type NullableLogoutFlow struct { diff --git a/internal/httpclient/model_message.go b/internal/httpclient/model_message.go index 405575779c78..011a69dce172 100644 --- a/internal/httpclient/model_message.go +++ b/internal/httpclient/model_message.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the Message type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Message{} + // Message struct for Message type Message struct { Body string `json:"body"` @@ -36,6 +41,8 @@ type Message struct { UpdatedAt time.Time `json:"updated_at"` } +type _Message Message + // NewMessage instantiates a new Message object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -89,7 +96,7 @@ func (o *Message) SetBody(v string) { // GetChannel returns the Channel field value if set, zero value otherwise. func (o *Message) GetChannel() string { - if o == nil || o.Channel == nil { + if o == nil || IsNil(o.Channel) { var ret string return ret } @@ -99,7 +106,7 @@ func (o *Message) GetChannel() string { // GetChannelOk returns a tuple with the Channel field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Message) GetChannelOk() (*string, bool) { - if o == nil || o.Channel == nil { + if o == nil || IsNil(o.Channel) { return nil, false } return o.Channel, true @@ -107,7 +114,7 @@ func (o *Message) GetChannelOk() (*string, bool) { // HasChannel returns a boolean if a field has been set. func (o *Message) HasChannel() bool { - if o != nil && o.Channel != nil { + if o != nil && !IsNil(o.Channel) { return true } @@ -145,7 +152,7 @@ func (o *Message) SetCreatedAt(v time.Time) { // GetDispatches returns the Dispatches field value if set, zero value otherwise. func (o *Message) GetDispatches() []MessageDispatch { - if o == nil || o.Dispatches == nil { + if o == nil || IsNil(o.Dispatches) { var ret []MessageDispatch return ret } @@ -155,7 +162,7 @@ func (o *Message) GetDispatches() []MessageDispatch { // GetDispatchesOk returns a tuple with the Dispatches field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Message) GetDispatchesOk() ([]MessageDispatch, bool) { - if o == nil || o.Dispatches == nil { + if o == nil || IsNil(o.Dispatches) { return nil, false } return o.Dispatches, true @@ -163,7 +170,7 @@ func (o *Message) GetDispatchesOk() ([]MessageDispatch, bool) { // HasDispatches returns a boolean if a field has been set. func (o *Message) HasDispatches() bool { - if o != nil && o.Dispatches != nil { + if o != nil && !IsNil(o.Dispatches) { return true } @@ -368,44 +375,78 @@ func (o *Message) SetUpdatedAt(v time.Time) { } func (o Message) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["body"] = o.Body + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Channel != nil { + return json.Marshal(toSerialize) +} + +func (o Message) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["body"] = o.Body + if !IsNil(o.Channel) { toSerialize["channel"] = o.Channel } - if true { - toSerialize["created_at"] = o.CreatedAt - } - if o.Dispatches != nil { + toSerialize["created_at"] = o.CreatedAt + if !IsNil(o.Dispatches) { toSerialize["dispatches"] = o.Dispatches } - if true { - toSerialize["id"] = o.Id - } - if true { - toSerialize["recipient"] = o.Recipient - } - if true { - toSerialize["send_count"] = o.SendCount - } - if true { - toSerialize["status"] = o.Status - } - if true { - toSerialize["subject"] = o.Subject + toSerialize["id"] = o.Id + toSerialize["recipient"] = o.Recipient + toSerialize["send_count"] = o.SendCount + toSerialize["status"] = o.Status + toSerialize["subject"] = o.Subject + toSerialize["template_type"] = o.TemplateType + toSerialize["type"] = o.Type + toSerialize["updated_at"] = o.UpdatedAt + return toSerialize, nil +} + +func (o *Message) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "body", + "created_at", + "id", + "recipient", + "send_count", + "status", + "subject", + "template_type", + "type", + "updated_at", } - if true { - toSerialize["template_type"] = o.TemplateType + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["type"] = o.Type + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["updated_at"] = o.UpdatedAt + + varMessage := _Message{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varMessage) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = Message(varMessage) + + return err } type NullableMessage struct { diff --git a/internal/httpclient/model_message_dispatch.go b/internal/httpclient/model_message_dispatch.go index d5ad3a2b670b..717475a4828c 100644 --- a/internal/httpclient/model_message_dispatch.go +++ b/internal/httpclient/model_message_dispatch.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the MessageDispatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MessageDispatch{} + // MessageDispatch MessageDispatch represents an attempt of sending a courier message It contains the status of the attempt (failed or successful) and the error if any occured type MessageDispatch struct { // CreatedAt is a helper struct field for gobuffalo.pop. @@ -31,6 +36,8 @@ type MessageDispatch struct { UpdatedAt time.Time `json:"updated_at"` } +type _MessageDispatch MessageDispatch + // NewMessageDispatch instantiates a new MessageDispatch object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -79,7 +86,7 @@ func (o *MessageDispatch) SetCreatedAt(v time.Time) { // GetError returns the Error field value if set, zero value otherwise. func (o *MessageDispatch) GetError() map[string]interface{} { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret map[string]interface{} return ret } @@ -89,15 +96,15 @@ func (o *MessageDispatch) GetError() map[string]interface{} { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *MessageDispatch) GetErrorOk() (map[string]interface{}, bool) { - if o == nil || o.Error == nil { - return nil, false + if o == nil || IsNil(o.Error) { + return map[string]interface{}{}, false } return o.Error, true } // HasError returns a boolean if a field has been set. func (o *MessageDispatch) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -206,26 +213,65 @@ func (o *MessageDispatch) SetUpdatedAt(v time.Time) { } func (o MessageDispatch) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["created_at"] = o.CreatedAt + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Error != nil { + return json.Marshal(toSerialize) +} + +func (o MessageDispatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["created_at"] = o.CreatedAt + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if true { - toSerialize["id"] = o.Id + toSerialize["id"] = o.Id + toSerialize["message_id"] = o.MessageId + toSerialize["status"] = o.Status + toSerialize["updated_at"] = o.UpdatedAt + return toSerialize, nil +} + +func (o *MessageDispatch) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "created_at", + "id", + "message_id", + "status", + "updated_at", } - if true { - toSerialize["message_id"] = o.MessageId + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["status"] = o.Status + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["updated_at"] = o.UpdatedAt + + varMessageDispatch := _MessageDispatch{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varMessageDispatch) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = MessageDispatch(varMessageDispatch) + + return err } type NullableMessageDispatch struct { diff --git a/internal/httpclient/model_needs_privileged_session_error.go b/internal/httpclient/model_needs_privileged_session_error.go index ea91c4ba2331..6935f89fdc49 100644 --- a/internal/httpclient/model_needs_privileged_session_error.go +++ b/internal/httpclient/model_needs_privileged_session_error.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the NeedsPrivilegedSessionError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NeedsPrivilegedSessionError{} + // NeedsPrivilegedSessionError struct for NeedsPrivilegedSessionError type NeedsPrivilegedSessionError struct { Error *GenericError `json:"error,omitempty"` @@ -22,6 +27,8 @@ type NeedsPrivilegedSessionError struct { RedirectBrowserTo string `json:"redirect_browser_to"` } +type _NeedsPrivilegedSessionError NeedsPrivilegedSessionError + // NewNeedsPrivilegedSessionError instantiates a new NeedsPrivilegedSessionError object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -42,7 +49,7 @@ func NewNeedsPrivilegedSessionErrorWithDefaults() *NeedsPrivilegedSessionError { // GetError returns the Error field value if set, zero value otherwise. func (o *NeedsPrivilegedSessionError) GetError() GenericError { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret GenericError return ret } @@ -52,7 +59,7 @@ func (o *NeedsPrivilegedSessionError) GetError() GenericError { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *NeedsPrivilegedSessionError) GetErrorOk() (*GenericError, bool) { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { return nil, false } return o.Error, true @@ -60,7 +67,7 @@ func (o *NeedsPrivilegedSessionError) GetErrorOk() (*GenericError, bool) { // HasError returns a boolean if a field has been set. func (o *NeedsPrivilegedSessionError) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -97,14 +104,57 @@ func (o *NeedsPrivilegedSessionError) SetRedirectBrowserTo(v string) { } func (o NeedsPrivilegedSessionError) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NeedsPrivilegedSessionError) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Error != nil { + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if true { - toSerialize["redirect_browser_to"] = o.RedirectBrowserTo + toSerialize["redirect_browser_to"] = o.RedirectBrowserTo + return toSerialize, nil +} + +func (o *NeedsPrivilegedSessionError) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "redirect_browser_to", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varNeedsPrivilegedSessionError := _NeedsPrivilegedSessionError{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varNeedsPrivilegedSessionError) + + if err != nil { + return err + } + + *o = NeedsPrivilegedSessionError(varNeedsPrivilegedSessionError) + + return err } type NullableNeedsPrivilegedSessionError struct { diff --git a/internal/httpclient/model_o_auth2_client.go b/internal/httpclient/model_o_auth2_client.go index eab35e350486..f2267ef948df 100644 --- a/internal/httpclient/model_o_auth2_client.go +++ b/internal/httpclient/model_o_auth2_client.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -16,6 +16,9 @@ import ( "time" ) +// checks if the OAuth2Client type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OAuth2Client{} + // OAuth2Client struct for OAuth2Client type OAuth2Client struct { AdditionalPropertiesField map[string]interface{} `json:"AdditionalProperties,omitempty"` @@ -125,7 +128,7 @@ func NewOAuth2ClientWithDefaults() *OAuth2Client { // GetAdditionalPropertiesField returns the AdditionalPropertiesField field value if set, zero value otherwise. func (o *OAuth2Client) GetAdditionalPropertiesField() map[string]interface{} { - if o == nil || o.AdditionalPropertiesField == nil { + if o == nil || IsNil(o.AdditionalPropertiesField) { var ret map[string]interface{} return ret } @@ -135,15 +138,15 @@ func (o *OAuth2Client) GetAdditionalPropertiesField() map[string]interface{} { // GetAdditionalPropertiesFieldOk returns a tuple with the AdditionalPropertiesField field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAdditionalPropertiesFieldOk() (map[string]interface{}, bool) { - if o == nil || o.AdditionalPropertiesField == nil { - return nil, false + if o == nil || IsNil(o.AdditionalPropertiesField) { + return map[string]interface{}{}, false } return o.AdditionalPropertiesField, true } // HasAdditionalPropertiesField returns a boolean if a field has been set. func (o *OAuth2Client) HasAdditionalPropertiesField() bool { - if o != nil && o.AdditionalPropertiesField != nil { + if o != nil && !IsNil(o.AdditionalPropertiesField) { return true } @@ -157,7 +160,7 @@ func (o *OAuth2Client) SetAdditionalPropertiesField(v map[string]interface{}) { // GetAccessTokenStrategy returns the AccessTokenStrategy field value if set, zero value otherwise. func (o *OAuth2Client) GetAccessTokenStrategy() string { - if o == nil || o.AccessTokenStrategy == nil { + if o == nil || IsNil(o.AccessTokenStrategy) { var ret string return ret } @@ -167,7 +170,7 @@ func (o *OAuth2Client) GetAccessTokenStrategy() string { // GetAccessTokenStrategyOk returns a tuple with the AccessTokenStrategy field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAccessTokenStrategyOk() (*string, bool) { - if o == nil || o.AccessTokenStrategy == nil { + if o == nil || IsNil(o.AccessTokenStrategy) { return nil, false } return o.AccessTokenStrategy, true @@ -175,7 +178,7 @@ func (o *OAuth2Client) GetAccessTokenStrategyOk() (*string, bool) { // HasAccessTokenStrategy returns a boolean if a field has been set. func (o *OAuth2Client) HasAccessTokenStrategy() bool { - if o != nil && o.AccessTokenStrategy != nil { + if o != nil && !IsNil(o.AccessTokenStrategy) { return true } @@ -189,7 +192,7 @@ func (o *OAuth2Client) SetAccessTokenStrategy(v string) { // GetAllowedCorsOrigins returns the AllowedCorsOrigins field value if set, zero value otherwise. func (o *OAuth2Client) GetAllowedCorsOrigins() []string { - if o == nil || o.AllowedCorsOrigins == nil { + if o == nil || IsNil(o.AllowedCorsOrigins) { var ret []string return ret } @@ -199,7 +202,7 @@ func (o *OAuth2Client) GetAllowedCorsOrigins() []string { // GetAllowedCorsOriginsOk returns a tuple with the AllowedCorsOrigins field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAllowedCorsOriginsOk() ([]string, bool) { - if o == nil || o.AllowedCorsOrigins == nil { + if o == nil || IsNil(o.AllowedCorsOrigins) { return nil, false } return o.AllowedCorsOrigins, true @@ -207,7 +210,7 @@ func (o *OAuth2Client) GetAllowedCorsOriginsOk() ([]string, bool) { // HasAllowedCorsOrigins returns a boolean if a field has been set. func (o *OAuth2Client) HasAllowedCorsOrigins() bool { - if o != nil && o.AllowedCorsOrigins != nil { + if o != nil && !IsNil(o.AllowedCorsOrigins) { return true } @@ -221,7 +224,7 @@ func (o *OAuth2Client) SetAllowedCorsOrigins(v []string) { // GetAudience returns the Audience field value if set, zero value otherwise. func (o *OAuth2Client) GetAudience() []string { - if o == nil || o.Audience == nil { + if o == nil || IsNil(o.Audience) { var ret []string return ret } @@ -231,7 +234,7 @@ func (o *OAuth2Client) GetAudience() []string { // GetAudienceOk returns a tuple with the Audience field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAudienceOk() ([]string, bool) { - if o == nil || o.Audience == nil { + if o == nil || IsNil(o.Audience) { return nil, false } return o.Audience, true @@ -239,7 +242,7 @@ func (o *OAuth2Client) GetAudienceOk() ([]string, bool) { // HasAudience returns a boolean if a field has been set. func (o *OAuth2Client) HasAudience() bool { - if o != nil && o.Audience != nil { + if o != nil && !IsNil(o.Audience) { return true } @@ -253,7 +256,7 @@ func (o *OAuth2Client) SetAudience(v []string) { // GetAuthorizationCodeGrantAccessTokenLifespan returns the AuthorizationCodeGrantAccessTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetAuthorizationCodeGrantAccessTokenLifespan() string { - if o == nil || o.AuthorizationCodeGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.AuthorizationCodeGrantAccessTokenLifespan) { var ret string return ret } @@ -263,7 +266,7 @@ func (o *OAuth2Client) GetAuthorizationCodeGrantAccessTokenLifespan() string { // GetAuthorizationCodeGrantAccessTokenLifespanOk returns a tuple with the AuthorizationCodeGrantAccessTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAuthorizationCodeGrantAccessTokenLifespanOk() (*string, bool) { - if o == nil || o.AuthorizationCodeGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.AuthorizationCodeGrantAccessTokenLifespan) { return nil, false } return o.AuthorizationCodeGrantAccessTokenLifespan, true @@ -271,7 +274,7 @@ func (o *OAuth2Client) GetAuthorizationCodeGrantAccessTokenLifespanOk() (*string // HasAuthorizationCodeGrantAccessTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasAuthorizationCodeGrantAccessTokenLifespan() bool { - if o != nil && o.AuthorizationCodeGrantAccessTokenLifespan != nil { + if o != nil && !IsNil(o.AuthorizationCodeGrantAccessTokenLifespan) { return true } @@ -285,7 +288,7 @@ func (o *OAuth2Client) SetAuthorizationCodeGrantAccessTokenLifespan(v string) { // GetAuthorizationCodeGrantIdTokenLifespan returns the AuthorizationCodeGrantIdTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetAuthorizationCodeGrantIdTokenLifespan() string { - if o == nil || o.AuthorizationCodeGrantIdTokenLifespan == nil { + if o == nil || IsNil(o.AuthorizationCodeGrantIdTokenLifespan) { var ret string return ret } @@ -295,7 +298,7 @@ func (o *OAuth2Client) GetAuthorizationCodeGrantIdTokenLifespan() string { // GetAuthorizationCodeGrantIdTokenLifespanOk returns a tuple with the AuthorizationCodeGrantIdTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAuthorizationCodeGrantIdTokenLifespanOk() (*string, bool) { - if o == nil || o.AuthorizationCodeGrantIdTokenLifespan == nil { + if o == nil || IsNil(o.AuthorizationCodeGrantIdTokenLifespan) { return nil, false } return o.AuthorizationCodeGrantIdTokenLifespan, true @@ -303,7 +306,7 @@ func (o *OAuth2Client) GetAuthorizationCodeGrantIdTokenLifespanOk() (*string, bo // HasAuthorizationCodeGrantIdTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasAuthorizationCodeGrantIdTokenLifespan() bool { - if o != nil && o.AuthorizationCodeGrantIdTokenLifespan != nil { + if o != nil && !IsNil(o.AuthorizationCodeGrantIdTokenLifespan) { return true } @@ -317,7 +320,7 @@ func (o *OAuth2Client) SetAuthorizationCodeGrantIdTokenLifespan(v string) { // GetAuthorizationCodeGrantRefreshTokenLifespan returns the AuthorizationCodeGrantRefreshTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetAuthorizationCodeGrantRefreshTokenLifespan() string { - if o == nil || o.AuthorizationCodeGrantRefreshTokenLifespan == nil { + if o == nil || IsNil(o.AuthorizationCodeGrantRefreshTokenLifespan) { var ret string return ret } @@ -327,7 +330,7 @@ func (o *OAuth2Client) GetAuthorizationCodeGrantRefreshTokenLifespan() string { // GetAuthorizationCodeGrantRefreshTokenLifespanOk returns a tuple with the AuthorizationCodeGrantRefreshTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetAuthorizationCodeGrantRefreshTokenLifespanOk() (*string, bool) { - if o == nil || o.AuthorizationCodeGrantRefreshTokenLifespan == nil { + if o == nil || IsNil(o.AuthorizationCodeGrantRefreshTokenLifespan) { return nil, false } return o.AuthorizationCodeGrantRefreshTokenLifespan, true @@ -335,7 +338,7 @@ func (o *OAuth2Client) GetAuthorizationCodeGrantRefreshTokenLifespanOk() (*strin // HasAuthorizationCodeGrantRefreshTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasAuthorizationCodeGrantRefreshTokenLifespan() bool { - if o != nil && o.AuthorizationCodeGrantRefreshTokenLifespan != nil { + if o != nil && !IsNil(o.AuthorizationCodeGrantRefreshTokenLifespan) { return true } @@ -349,7 +352,7 @@ func (o *OAuth2Client) SetAuthorizationCodeGrantRefreshTokenLifespan(v string) { // GetBackchannelLogoutSessionRequired returns the BackchannelLogoutSessionRequired field value if set, zero value otherwise. func (o *OAuth2Client) GetBackchannelLogoutSessionRequired() bool { - if o == nil || o.BackchannelLogoutSessionRequired == nil { + if o == nil || IsNil(o.BackchannelLogoutSessionRequired) { var ret bool return ret } @@ -359,7 +362,7 @@ func (o *OAuth2Client) GetBackchannelLogoutSessionRequired() bool { // GetBackchannelLogoutSessionRequiredOk returns a tuple with the BackchannelLogoutSessionRequired field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetBackchannelLogoutSessionRequiredOk() (*bool, bool) { - if o == nil || o.BackchannelLogoutSessionRequired == nil { + if o == nil || IsNil(o.BackchannelLogoutSessionRequired) { return nil, false } return o.BackchannelLogoutSessionRequired, true @@ -367,7 +370,7 @@ func (o *OAuth2Client) GetBackchannelLogoutSessionRequiredOk() (*bool, bool) { // HasBackchannelLogoutSessionRequired returns a boolean if a field has been set. func (o *OAuth2Client) HasBackchannelLogoutSessionRequired() bool { - if o != nil && o.BackchannelLogoutSessionRequired != nil { + if o != nil && !IsNil(o.BackchannelLogoutSessionRequired) { return true } @@ -381,7 +384,7 @@ func (o *OAuth2Client) SetBackchannelLogoutSessionRequired(v bool) { // GetBackchannelLogoutUri returns the BackchannelLogoutUri field value if set, zero value otherwise. func (o *OAuth2Client) GetBackchannelLogoutUri() string { - if o == nil || o.BackchannelLogoutUri == nil { + if o == nil || IsNil(o.BackchannelLogoutUri) { var ret string return ret } @@ -391,7 +394,7 @@ func (o *OAuth2Client) GetBackchannelLogoutUri() string { // GetBackchannelLogoutUriOk returns a tuple with the BackchannelLogoutUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetBackchannelLogoutUriOk() (*string, bool) { - if o == nil || o.BackchannelLogoutUri == nil { + if o == nil || IsNil(o.BackchannelLogoutUri) { return nil, false } return o.BackchannelLogoutUri, true @@ -399,7 +402,7 @@ func (o *OAuth2Client) GetBackchannelLogoutUriOk() (*string, bool) { // HasBackchannelLogoutUri returns a boolean if a field has been set. func (o *OAuth2Client) HasBackchannelLogoutUri() bool { - if o != nil && o.BackchannelLogoutUri != nil { + if o != nil && !IsNil(o.BackchannelLogoutUri) { return true } @@ -413,7 +416,7 @@ func (o *OAuth2Client) SetBackchannelLogoutUri(v string) { // GetClientCredentialsGrantAccessTokenLifespan returns the ClientCredentialsGrantAccessTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetClientCredentialsGrantAccessTokenLifespan() string { - if o == nil || o.ClientCredentialsGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.ClientCredentialsGrantAccessTokenLifespan) { var ret string return ret } @@ -423,7 +426,7 @@ func (o *OAuth2Client) GetClientCredentialsGrantAccessTokenLifespan() string { // GetClientCredentialsGrantAccessTokenLifespanOk returns a tuple with the ClientCredentialsGrantAccessTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetClientCredentialsGrantAccessTokenLifespanOk() (*string, bool) { - if o == nil || o.ClientCredentialsGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.ClientCredentialsGrantAccessTokenLifespan) { return nil, false } return o.ClientCredentialsGrantAccessTokenLifespan, true @@ -431,7 +434,7 @@ func (o *OAuth2Client) GetClientCredentialsGrantAccessTokenLifespanOk() (*string // HasClientCredentialsGrantAccessTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasClientCredentialsGrantAccessTokenLifespan() bool { - if o != nil && o.ClientCredentialsGrantAccessTokenLifespan != nil { + if o != nil && !IsNil(o.ClientCredentialsGrantAccessTokenLifespan) { return true } @@ -445,7 +448,7 @@ func (o *OAuth2Client) SetClientCredentialsGrantAccessTokenLifespan(v string) { // GetClientId returns the ClientId field value if set, zero value otherwise. func (o *OAuth2Client) GetClientId() string { - if o == nil || o.ClientId == nil { + if o == nil || IsNil(o.ClientId) { var ret string return ret } @@ -455,7 +458,7 @@ func (o *OAuth2Client) GetClientId() string { // GetClientIdOk returns a tuple with the ClientId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetClientIdOk() (*string, bool) { - if o == nil || o.ClientId == nil { + if o == nil || IsNil(o.ClientId) { return nil, false } return o.ClientId, true @@ -463,7 +466,7 @@ func (o *OAuth2Client) GetClientIdOk() (*string, bool) { // HasClientId returns a boolean if a field has been set. func (o *OAuth2Client) HasClientId() bool { - if o != nil && o.ClientId != nil { + if o != nil && !IsNil(o.ClientId) { return true } @@ -477,7 +480,7 @@ func (o *OAuth2Client) SetClientId(v string) { // GetClientName returns the ClientName field value if set, zero value otherwise. func (o *OAuth2Client) GetClientName() string { - if o == nil || o.ClientName == nil { + if o == nil || IsNil(o.ClientName) { var ret string return ret } @@ -487,7 +490,7 @@ func (o *OAuth2Client) GetClientName() string { // GetClientNameOk returns a tuple with the ClientName field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetClientNameOk() (*string, bool) { - if o == nil || o.ClientName == nil { + if o == nil || IsNil(o.ClientName) { return nil, false } return o.ClientName, true @@ -495,7 +498,7 @@ func (o *OAuth2Client) GetClientNameOk() (*string, bool) { // HasClientName returns a boolean if a field has been set. func (o *OAuth2Client) HasClientName() bool { - if o != nil && o.ClientName != nil { + if o != nil && !IsNil(o.ClientName) { return true } @@ -509,7 +512,7 @@ func (o *OAuth2Client) SetClientName(v string) { // GetClientSecret returns the ClientSecret field value if set, zero value otherwise. func (o *OAuth2Client) GetClientSecret() string { - if o == nil || o.ClientSecret == nil { + if o == nil || IsNil(o.ClientSecret) { var ret string return ret } @@ -519,7 +522,7 @@ func (o *OAuth2Client) GetClientSecret() string { // GetClientSecretOk returns a tuple with the ClientSecret field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetClientSecretOk() (*string, bool) { - if o == nil || o.ClientSecret == nil { + if o == nil || IsNil(o.ClientSecret) { return nil, false } return o.ClientSecret, true @@ -527,7 +530,7 @@ func (o *OAuth2Client) GetClientSecretOk() (*string, bool) { // HasClientSecret returns a boolean if a field has been set. func (o *OAuth2Client) HasClientSecret() bool { - if o != nil && o.ClientSecret != nil { + if o != nil && !IsNil(o.ClientSecret) { return true } @@ -541,7 +544,7 @@ func (o *OAuth2Client) SetClientSecret(v string) { // GetClientSecretExpiresAt returns the ClientSecretExpiresAt field value if set, zero value otherwise. func (o *OAuth2Client) GetClientSecretExpiresAt() int64 { - if o == nil || o.ClientSecretExpiresAt == nil { + if o == nil || IsNil(o.ClientSecretExpiresAt) { var ret int64 return ret } @@ -551,7 +554,7 @@ func (o *OAuth2Client) GetClientSecretExpiresAt() int64 { // GetClientSecretExpiresAtOk returns a tuple with the ClientSecretExpiresAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetClientSecretExpiresAtOk() (*int64, bool) { - if o == nil || o.ClientSecretExpiresAt == nil { + if o == nil || IsNil(o.ClientSecretExpiresAt) { return nil, false } return o.ClientSecretExpiresAt, true @@ -559,7 +562,7 @@ func (o *OAuth2Client) GetClientSecretExpiresAtOk() (*int64, bool) { // HasClientSecretExpiresAt returns a boolean if a field has been set. func (o *OAuth2Client) HasClientSecretExpiresAt() bool { - if o != nil && o.ClientSecretExpiresAt != nil { + if o != nil && !IsNil(o.ClientSecretExpiresAt) { return true } @@ -573,7 +576,7 @@ func (o *OAuth2Client) SetClientSecretExpiresAt(v int64) { // GetClientUri returns the ClientUri field value if set, zero value otherwise. func (o *OAuth2Client) GetClientUri() string { - if o == nil || o.ClientUri == nil { + if o == nil || IsNil(o.ClientUri) { var ret string return ret } @@ -583,7 +586,7 @@ func (o *OAuth2Client) GetClientUri() string { // GetClientUriOk returns a tuple with the ClientUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetClientUriOk() (*string, bool) { - if o == nil || o.ClientUri == nil { + if o == nil || IsNil(o.ClientUri) { return nil, false } return o.ClientUri, true @@ -591,7 +594,7 @@ func (o *OAuth2Client) GetClientUriOk() (*string, bool) { // HasClientUri returns a boolean if a field has been set. func (o *OAuth2Client) HasClientUri() bool { - if o != nil && o.ClientUri != nil { + if o != nil && !IsNil(o.ClientUri) { return true } @@ -605,7 +608,7 @@ func (o *OAuth2Client) SetClientUri(v string) { // GetContacts returns the Contacts field value if set, zero value otherwise. func (o *OAuth2Client) GetContacts() []string { - if o == nil || o.Contacts == nil { + if o == nil || IsNil(o.Contacts) { var ret []string return ret } @@ -615,7 +618,7 @@ func (o *OAuth2Client) GetContacts() []string { // GetContactsOk returns a tuple with the Contacts field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetContactsOk() ([]string, bool) { - if o == nil || o.Contacts == nil { + if o == nil || IsNil(o.Contacts) { return nil, false } return o.Contacts, true @@ -623,7 +626,7 @@ func (o *OAuth2Client) GetContactsOk() ([]string, bool) { // HasContacts returns a boolean if a field has been set. func (o *OAuth2Client) HasContacts() bool { - if o != nil && o.Contacts != nil { + if o != nil && !IsNil(o.Contacts) { return true } @@ -637,7 +640,7 @@ func (o *OAuth2Client) SetContacts(v []string) { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *OAuth2Client) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -647,7 +650,7 @@ func (o *OAuth2Client) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -655,7 +658,7 @@ func (o *OAuth2Client) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *OAuth2Client) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -669,7 +672,7 @@ func (o *OAuth2Client) SetCreatedAt(v time.Time) { // GetFrontchannelLogoutSessionRequired returns the FrontchannelLogoutSessionRequired field value if set, zero value otherwise. func (o *OAuth2Client) GetFrontchannelLogoutSessionRequired() bool { - if o == nil || o.FrontchannelLogoutSessionRequired == nil { + if o == nil || IsNil(o.FrontchannelLogoutSessionRequired) { var ret bool return ret } @@ -679,7 +682,7 @@ func (o *OAuth2Client) GetFrontchannelLogoutSessionRequired() bool { // GetFrontchannelLogoutSessionRequiredOk returns a tuple with the FrontchannelLogoutSessionRequired field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetFrontchannelLogoutSessionRequiredOk() (*bool, bool) { - if o == nil || o.FrontchannelLogoutSessionRequired == nil { + if o == nil || IsNil(o.FrontchannelLogoutSessionRequired) { return nil, false } return o.FrontchannelLogoutSessionRequired, true @@ -687,7 +690,7 @@ func (o *OAuth2Client) GetFrontchannelLogoutSessionRequiredOk() (*bool, bool) { // HasFrontchannelLogoutSessionRequired returns a boolean if a field has been set. func (o *OAuth2Client) HasFrontchannelLogoutSessionRequired() bool { - if o != nil && o.FrontchannelLogoutSessionRequired != nil { + if o != nil && !IsNil(o.FrontchannelLogoutSessionRequired) { return true } @@ -701,7 +704,7 @@ func (o *OAuth2Client) SetFrontchannelLogoutSessionRequired(v bool) { // GetFrontchannelLogoutUri returns the FrontchannelLogoutUri field value if set, zero value otherwise. func (o *OAuth2Client) GetFrontchannelLogoutUri() string { - if o == nil || o.FrontchannelLogoutUri == nil { + if o == nil || IsNil(o.FrontchannelLogoutUri) { var ret string return ret } @@ -711,7 +714,7 @@ func (o *OAuth2Client) GetFrontchannelLogoutUri() string { // GetFrontchannelLogoutUriOk returns a tuple with the FrontchannelLogoutUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetFrontchannelLogoutUriOk() (*string, bool) { - if o == nil || o.FrontchannelLogoutUri == nil { + if o == nil || IsNil(o.FrontchannelLogoutUri) { return nil, false } return o.FrontchannelLogoutUri, true @@ -719,7 +722,7 @@ func (o *OAuth2Client) GetFrontchannelLogoutUriOk() (*string, bool) { // HasFrontchannelLogoutUri returns a boolean if a field has been set. func (o *OAuth2Client) HasFrontchannelLogoutUri() bool { - if o != nil && o.FrontchannelLogoutUri != nil { + if o != nil && !IsNil(o.FrontchannelLogoutUri) { return true } @@ -733,7 +736,7 @@ func (o *OAuth2Client) SetFrontchannelLogoutUri(v string) { // GetGrantTypes returns the GrantTypes field value if set, zero value otherwise. func (o *OAuth2Client) GetGrantTypes() []string { - if o == nil || o.GrantTypes == nil { + if o == nil || IsNil(o.GrantTypes) { var ret []string return ret } @@ -743,7 +746,7 @@ func (o *OAuth2Client) GetGrantTypes() []string { // GetGrantTypesOk returns a tuple with the GrantTypes field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetGrantTypesOk() ([]string, bool) { - if o == nil || o.GrantTypes == nil { + if o == nil || IsNil(o.GrantTypes) { return nil, false } return o.GrantTypes, true @@ -751,7 +754,7 @@ func (o *OAuth2Client) GetGrantTypesOk() ([]string, bool) { // HasGrantTypes returns a boolean if a field has been set. func (o *OAuth2Client) HasGrantTypes() bool { - if o != nil && o.GrantTypes != nil { + if o != nil && !IsNil(o.GrantTypes) { return true } @@ -765,7 +768,7 @@ func (o *OAuth2Client) SetGrantTypes(v []string) { // GetImplicitGrantAccessTokenLifespan returns the ImplicitGrantAccessTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetImplicitGrantAccessTokenLifespan() string { - if o == nil || o.ImplicitGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.ImplicitGrantAccessTokenLifespan) { var ret string return ret } @@ -775,7 +778,7 @@ func (o *OAuth2Client) GetImplicitGrantAccessTokenLifespan() string { // GetImplicitGrantAccessTokenLifespanOk returns a tuple with the ImplicitGrantAccessTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetImplicitGrantAccessTokenLifespanOk() (*string, bool) { - if o == nil || o.ImplicitGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.ImplicitGrantAccessTokenLifespan) { return nil, false } return o.ImplicitGrantAccessTokenLifespan, true @@ -783,7 +786,7 @@ func (o *OAuth2Client) GetImplicitGrantAccessTokenLifespanOk() (*string, bool) { // HasImplicitGrantAccessTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasImplicitGrantAccessTokenLifespan() bool { - if o != nil && o.ImplicitGrantAccessTokenLifespan != nil { + if o != nil && !IsNil(o.ImplicitGrantAccessTokenLifespan) { return true } @@ -797,7 +800,7 @@ func (o *OAuth2Client) SetImplicitGrantAccessTokenLifespan(v string) { // GetImplicitGrantIdTokenLifespan returns the ImplicitGrantIdTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetImplicitGrantIdTokenLifespan() string { - if o == nil || o.ImplicitGrantIdTokenLifespan == nil { + if o == nil || IsNil(o.ImplicitGrantIdTokenLifespan) { var ret string return ret } @@ -807,7 +810,7 @@ func (o *OAuth2Client) GetImplicitGrantIdTokenLifespan() string { // GetImplicitGrantIdTokenLifespanOk returns a tuple with the ImplicitGrantIdTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetImplicitGrantIdTokenLifespanOk() (*string, bool) { - if o == nil || o.ImplicitGrantIdTokenLifespan == nil { + if o == nil || IsNil(o.ImplicitGrantIdTokenLifespan) { return nil, false } return o.ImplicitGrantIdTokenLifespan, true @@ -815,7 +818,7 @@ func (o *OAuth2Client) GetImplicitGrantIdTokenLifespanOk() (*string, bool) { // HasImplicitGrantIdTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasImplicitGrantIdTokenLifespan() bool { - if o != nil && o.ImplicitGrantIdTokenLifespan != nil { + if o != nil && !IsNil(o.ImplicitGrantIdTokenLifespan) { return true } @@ -840,7 +843,7 @@ func (o *OAuth2Client) GetJwks() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *OAuth2Client) GetJwksOk() (*interface{}, bool) { - if o == nil || o.Jwks == nil { + if o == nil || IsNil(o.Jwks) { return nil, false } return &o.Jwks, true @@ -848,7 +851,7 @@ func (o *OAuth2Client) GetJwksOk() (*interface{}, bool) { // HasJwks returns a boolean if a field has been set. func (o *OAuth2Client) HasJwks() bool { - if o != nil && o.Jwks != nil { + if o != nil && IsNil(o.Jwks) { return true } @@ -862,7 +865,7 @@ func (o *OAuth2Client) SetJwks(v interface{}) { // GetJwksUri returns the JwksUri field value if set, zero value otherwise. func (o *OAuth2Client) GetJwksUri() string { - if o == nil || o.JwksUri == nil { + if o == nil || IsNil(o.JwksUri) { var ret string return ret } @@ -872,7 +875,7 @@ func (o *OAuth2Client) GetJwksUri() string { // GetJwksUriOk returns a tuple with the JwksUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetJwksUriOk() (*string, bool) { - if o == nil || o.JwksUri == nil { + if o == nil || IsNil(o.JwksUri) { return nil, false } return o.JwksUri, true @@ -880,7 +883,7 @@ func (o *OAuth2Client) GetJwksUriOk() (*string, bool) { // HasJwksUri returns a boolean if a field has been set. func (o *OAuth2Client) HasJwksUri() bool { - if o != nil && o.JwksUri != nil { + if o != nil && !IsNil(o.JwksUri) { return true } @@ -894,7 +897,7 @@ func (o *OAuth2Client) SetJwksUri(v string) { // GetJwtBearerGrantAccessTokenLifespan returns the JwtBearerGrantAccessTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetJwtBearerGrantAccessTokenLifespan() string { - if o == nil || o.JwtBearerGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.JwtBearerGrantAccessTokenLifespan) { var ret string return ret } @@ -904,7 +907,7 @@ func (o *OAuth2Client) GetJwtBearerGrantAccessTokenLifespan() string { // GetJwtBearerGrantAccessTokenLifespanOk returns a tuple with the JwtBearerGrantAccessTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetJwtBearerGrantAccessTokenLifespanOk() (*string, bool) { - if o == nil || o.JwtBearerGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.JwtBearerGrantAccessTokenLifespan) { return nil, false } return o.JwtBearerGrantAccessTokenLifespan, true @@ -912,7 +915,7 @@ func (o *OAuth2Client) GetJwtBearerGrantAccessTokenLifespanOk() (*string, bool) // HasJwtBearerGrantAccessTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasJwtBearerGrantAccessTokenLifespan() bool { - if o != nil && o.JwtBearerGrantAccessTokenLifespan != nil { + if o != nil && !IsNil(o.JwtBearerGrantAccessTokenLifespan) { return true } @@ -926,7 +929,7 @@ func (o *OAuth2Client) SetJwtBearerGrantAccessTokenLifespan(v string) { // GetLogoUri returns the LogoUri field value if set, zero value otherwise. func (o *OAuth2Client) GetLogoUri() string { - if o == nil || o.LogoUri == nil { + if o == nil || IsNil(o.LogoUri) { var ret string return ret } @@ -936,7 +939,7 @@ func (o *OAuth2Client) GetLogoUri() string { // GetLogoUriOk returns a tuple with the LogoUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetLogoUriOk() (*string, bool) { - if o == nil || o.LogoUri == nil { + if o == nil || IsNil(o.LogoUri) { return nil, false } return o.LogoUri, true @@ -944,7 +947,7 @@ func (o *OAuth2Client) GetLogoUriOk() (*string, bool) { // HasLogoUri returns a boolean if a field has been set. func (o *OAuth2Client) HasLogoUri() bool { - if o != nil && o.LogoUri != nil { + if o != nil && !IsNil(o.LogoUri) { return true } @@ -969,7 +972,7 @@ func (o *OAuth2Client) GetMetadata() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *OAuth2Client) GetMetadataOk() (*interface{}, bool) { - if o == nil || o.Metadata == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } return &o.Metadata, true @@ -977,7 +980,7 @@ func (o *OAuth2Client) GetMetadataOk() (*interface{}, bool) { // HasMetadata returns a boolean if a field has been set. func (o *OAuth2Client) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && IsNil(o.Metadata) { return true } @@ -991,7 +994,7 @@ func (o *OAuth2Client) SetMetadata(v interface{}) { // GetOwner returns the Owner field value if set, zero value otherwise. func (o *OAuth2Client) GetOwner() string { - if o == nil || o.Owner == nil { + if o == nil || IsNil(o.Owner) { var ret string return ret } @@ -1001,7 +1004,7 @@ func (o *OAuth2Client) GetOwner() string { // GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetOwnerOk() (*string, bool) { - if o == nil || o.Owner == nil { + if o == nil || IsNil(o.Owner) { return nil, false } return o.Owner, true @@ -1009,7 +1012,7 @@ func (o *OAuth2Client) GetOwnerOk() (*string, bool) { // HasOwner returns a boolean if a field has been set. func (o *OAuth2Client) HasOwner() bool { - if o != nil && o.Owner != nil { + if o != nil && !IsNil(o.Owner) { return true } @@ -1023,7 +1026,7 @@ func (o *OAuth2Client) SetOwner(v string) { // GetPolicyUri returns the PolicyUri field value if set, zero value otherwise. func (o *OAuth2Client) GetPolicyUri() string { - if o == nil || o.PolicyUri == nil { + if o == nil || IsNil(o.PolicyUri) { var ret string return ret } @@ -1033,7 +1036,7 @@ func (o *OAuth2Client) GetPolicyUri() string { // GetPolicyUriOk returns a tuple with the PolicyUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetPolicyUriOk() (*string, bool) { - if o == nil || o.PolicyUri == nil { + if o == nil || IsNil(o.PolicyUri) { return nil, false } return o.PolicyUri, true @@ -1041,7 +1044,7 @@ func (o *OAuth2Client) GetPolicyUriOk() (*string, bool) { // HasPolicyUri returns a boolean if a field has been set. func (o *OAuth2Client) HasPolicyUri() bool { - if o != nil && o.PolicyUri != nil { + if o != nil && !IsNil(o.PolicyUri) { return true } @@ -1055,7 +1058,7 @@ func (o *OAuth2Client) SetPolicyUri(v string) { // GetPostLogoutRedirectUris returns the PostLogoutRedirectUris field value if set, zero value otherwise. func (o *OAuth2Client) GetPostLogoutRedirectUris() []string { - if o == nil || o.PostLogoutRedirectUris == nil { + if o == nil || IsNil(o.PostLogoutRedirectUris) { var ret []string return ret } @@ -1065,7 +1068,7 @@ func (o *OAuth2Client) GetPostLogoutRedirectUris() []string { // GetPostLogoutRedirectUrisOk returns a tuple with the PostLogoutRedirectUris field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetPostLogoutRedirectUrisOk() ([]string, bool) { - if o == nil || o.PostLogoutRedirectUris == nil { + if o == nil || IsNil(o.PostLogoutRedirectUris) { return nil, false } return o.PostLogoutRedirectUris, true @@ -1073,7 +1076,7 @@ func (o *OAuth2Client) GetPostLogoutRedirectUrisOk() ([]string, bool) { // HasPostLogoutRedirectUris returns a boolean if a field has been set. func (o *OAuth2Client) HasPostLogoutRedirectUris() bool { - if o != nil && o.PostLogoutRedirectUris != nil { + if o != nil && !IsNil(o.PostLogoutRedirectUris) { return true } @@ -1087,7 +1090,7 @@ func (o *OAuth2Client) SetPostLogoutRedirectUris(v []string) { // GetRedirectUris returns the RedirectUris field value if set, zero value otherwise. func (o *OAuth2Client) GetRedirectUris() []string { - if o == nil || o.RedirectUris == nil { + if o == nil || IsNil(o.RedirectUris) { var ret []string return ret } @@ -1097,7 +1100,7 @@ func (o *OAuth2Client) GetRedirectUris() []string { // GetRedirectUrisOk returns a tuple with the RedirectUris field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRedirectUrisOk() ([]string, bool) { - if o == nil || o.RedirectUris == nil { + if o == nil || IsNil(o.RedirectUris) { return nil, false } return o.RedirectUris, true @@ -1105,7 +1108,7 @@ func (o *OAuth2Client) GetRedirectUrisOk() ([]string, bool) { // HasRedirectUris returns a boolean if a field has been set. func (o *OAuth2Client) HasRedirectUris() bool { - if o != nil && o.RedirectUris != nil { + if o != nil && !IsNil(o.RedirectUris) { return true } @@ -1119,7 +1122,7 @@ func (o *OAuth2Client) SetRedirectUris(v []string) { // GetRefreshTokenGrantAccessTokenLifespan returns the RefreshTokenGrantAccessTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetRefreshTokenGrantAccessTokenLifespan() string { - if o == nil || o.RefreshTokenGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.RefreshTokenGrantAccessTokenLifespan) { var ret string return ret } @@ -1129,7 +1132,7 @@ func (o *OAuth2Client) GetRefreshTokenGrantAccessTokenLifespan() string { // GetRefreshTokenGrantAccessTokenLifespanOk returns a tuple with the RefreshTokenGrantAccessTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRefreshTokenGrantAccessTokenLifespanOk() (*string, bool) { - if o == nil || o.RefreshTokenGrantAccessTokenLifespan == nil { + if o == nil || IsNil(o.RefreshTokenGrantAccessTokenLifespan) { return nil, false } return o.RefreshTokenGrantAccessTokenLifespan, true @@ -1137,7 +1140,7 @@ func (o *OAuth2Client) GetRefreshTokenGrantAccessTokenLifespanOk() (*string, boo // HasRefreshTokenGrantAccessTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasRefreshTokenGrantAccessTokenLifespan() bool { - if o != nil && o.RefreshTokenGrantAccessTokenLifespan != nil { + if o != nil && !IsNil(o.RefreshTokenGrantAccessTokenLifespan) { return true } @@ -1151,7 +1154,7 @@ func (o *OAuth2Client) SetRefreshTokenGrantAccessTokenLifespan(v string) { // GetRefreshTokenGrantIdTokenLifespan returns the RefreshTokenGrantIdTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetRefreshTokenGrantIdTokenLifespan() string { - if o == nil || o.RefreshTokenGrantIdTokenLifespan == nil { + if o == nil || IsNil(o.RefreshTokenGrantIdTokenLifespan) { var ret string return ret } @@ -1161,7 +1164,7 @@ func (o *OAuth2Client) GetRefreshTokenGrantIdTokenLifespan() string { // GetRefreshTokenGrantIdTokenLifespanOk returns a tuple with the RefreshTokenGrantIdTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRefreshTokenGrantIdTokenLifespanOk() (*string, bool) { - if o == nil || o.RefreshTokenGrantIdTokenLifespan == nil { + if o == nil || IsNil(o.RefreshTokenGrantIdTokenLifespan) { return nil, false } return o.RefreshTokenGrantIdTokenLifespan, true @@ -1169,7 +1172,7 @@ func (o *OAuth2Client) GetRefreshTokenGrantIdTokenLifespanOk() (*string, bool) { // HasRefreshTokenGrantIdTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasRefreshTokenGrantIdTokenLifespan() bool { - if o != nil && o.RefreshTokenGrantIdTokenLifespan != nil { + if o != nil && !IsNil(o.RefreshTokenGrantIdTokenLifespan) { return true } @@ -1183,7 +1186,7 @@ func (o *OAuth2Client) SetRefreshTokenGrantIdTokenLifespan(v string) { // GetRefreshTokenGrantRefreshTokenLifespan returns the RefreshTokenGrantRefreshTokenLifespan field value if set, zero value otherwise. func (o *OAuth2Client) GetRefreshTokenGrantRefreshTokenLifespan() string { - if o == nil || o.RefreshTokenGrantRefreshTokenLifespan == nil { + if o == nil || IsNil(o.RefreshTokenGrantRefreshTokenLifespan) { var ret string return ret } @@ -1193,7 +1196,7 @@ func (o *OAuth2Client) GetRefreshTokenGrantRefreshTokenLifespan() string { // GetRefreshTokenGrantRefreshTokenLifespanOk returns a tuple with the RefreshTokenGrantRefreshTokenLifespan field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRefreshTokenGrantRefreshTokenLifespanOk() (*string, bool) { - if o == nil || o.RefreshTokenGrantRefreshTokenLifespan == nil { + if o == nil || IsNil(o.RefreshTokenGrantRefreshTokenLifespan) { return nil, false } return o.RefreshTokenGrantRefreshTokenLifespan, true @@ -1201,7 +1204,7 @@ func (o *OAuth2Client) GetRefreshTokenGrantRefreshTokenLifespanOk() (*string, bo // HasRefreshTokenGrantRefreshTokenLifespan returns a boolean if a field has been set. func (o *OAuth2Client) HasRefreshTokenGrantRefreshTokenLifespan() bool { - if o != nil && o.RefreshTokenGrantRefreshTokenLifespan != nil { + if o != nil && !IsNil(o.RefreshTokenGrantRefreshTokenLifespan) { return true } @@ -1215,7 +1218,7 @@ func (o *OAuth2Client) SetRefreshTokenGrantRefreshTokenLifespan(v string) { // GetRegistrationAccessToken returns the RegistrationAccessToken field value if set, zero value otherwise. func (o *OAuth2Client) GetRegistrationAccessToken() string { - if o == nil || o.RegistrationAccessToken == nil { + if o == nil || IsNil(o.RegistrationAccessToken) { var ret string return ret } @@ -1225,7 +1228,7 @@ func (o *OAuth2Client) GetRegistrationAccessToken() string { // GetRegistrationAccessTokenOk returns a tuple with the RegistrationAccessToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRegistrationAccessTokenOk() (*string, bool) { - if o == nil || o.RegistrationAccessToken == nil { + if o == nil || IsNil(o.RegistrationAccessToken) { return nil, false } return o.RegistrationAccessToken, true @@ -1233,7 +1236,7 @@ func (o *OAuth2Client) GetRegistrationAccessTokenOk() (*string, bool) { // HasRegistrationAccessToken returns a boolean if a field has been set. func (o *OAuth2Client) HasRegistrationAccessToken() bool { - if o != nil && o.RegistrationAccessToken != nil { + if o != nil && !IsNil(o.RegistrationAccessToken) { return true } @@ -1247,7 +1250,7 @@ func (o *OAuth2Client) SetRegistrationAccessToken(v string) { // GetRegistrationClientUri returns the RegistrationClientUri field value if set, zero value otherwise. func (o *OAuth2Client) GetRegistrationClientUri() string { - if o == nil || o.RegistrationClientUri == nil { + if o == nil || IsNil(o.RegistrationClientUri) { var ret string return ret } @@ -1257,7 +1260,7 @@ func (o *OAuth2Client) GetRegistrationClientUri() string { // GetRegistrationClientUriOk returns a tuple with the RegistrationClientUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRegistrationClientUriOk() (*string, bool) { - if o == nil || o.RegistrationClientUri == nil { + if o == nil || IsNil(o.RegistrationClientUri) { return nil, false } return o.RegistrationClientUri, true @@ -1265,7 +1268,7 @@ func (o *OAuth2Client) GetRegistrationClientUriOk() (*string, bool) { // HasRegistrationClientUri returns a boolean if a field has been set. func (o *OAuth2Client) HasRegistrationClientUri() bool { - if o != nil && o.RegistrationClientUri != nil { + if o != nil && !IsNil(o.RegistrationClientUri) { return true } @@ -1279,7 +1282,7 @@ func (o *OAuth2Client) SetRegistrationClientUri(v string) { // GetRequestObjectSigningAlg returns the RequestObjectSigningAlg field value if set, zero value otherwise. func (o *OAuth2Client) GetRequestObjectSigningAlg() string { - if o == nil || o.RequestObjectSigningAlg == nil { + if o == nil || IsNil(o.RequestObjectSigningAlg) { var ret string return ret } @@ -1289,7 +1292,7 @@ func (o *OAuth2Client) GetRequestObjectSigningAlg() string { // GetRequestObjectSigningAlgOk returns a tuple with the RequestObjectSigningAlg field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRequestObjectSigningAlgOk() (*string, bool) { - if o == nil || o.RequestObjectSigningAlg == nil { + if o == nil || IsNil(o.RequestObjectSigningAlg) { return nil, false } return o.RequestObjectSigningAlg, true @@ -1297,7 +1300,7 @@ func (o *OAuth2Client) GetRequestObjectSigningAlgOk() (*string, bool) { // HasRequestObjectSigningAlg returns a boolean if a field has been set. func (o *OAuth2Client) HasRequestObjectSigningAlg() bool { - if o != nil && o.RequestObjectSigningAlg != nil { + if o != nil && !IsNil(o.RequestObjectSigningAlg) { return true } @@ -1311,7 +1314,7 @@ func (o *OAuth2Client) SetRequestObjectSigningAlg(v string) { // GetRequestUris returns the RequestUris field value if set, zero value otherwise. func (o *OAuth2Client) GetRequestUris() []string { - if o == nil || o.RequestUris == nil { + if o == nil || IsNil(o.RequestUris) { var ret []string return ret } @@ -1321,7 +1324,7 @@ func (o *OAuth2Client) GetRequestUris() []string { // GetRequestUrisOk returns a tuple with the RequestUris field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetRequestUrisOk() ([]string, bool) { - if o == nil || o.RequestUris == nil { + if o == nil || IsNil(o.RequestUris) { return nil, false } return o.RequestUris, true @@ -1329,7 +1332,7 @@ func (o *OAuth2Client) GetRequestUrisOk() ([]string, bool) { // HasRequestUris returns a boolean if a field has been set. func (o *OAuth2Client) HasRequestUris() bool { - if o != nil && o.RequestUris != nil { + if o != nil && !IsNil(o.RequestUris) { return true } @@ -1343,7 +1346,7 @@ func (o *OAuth2Client) SetRequestUris(v []string) { // GetResponseTypes returns the ResponseTypes field value if set, zero value otherwise. func (o *OAuth2Client) GetResponseTypes() []string { - if o == nil || o.ResponseTypes == nil { + if o == nil || IsNil(o.ResponseTypes) { var ret []string return ret } @@ -1353,7 +1356,7 @@ func (o *OAuth2Client) GetResponseTypes() []string { // GetResponseTypesOk returns a tuple with the ResponseTypes field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetResponseTypesOk() ([]string, bool) { - if o == nil || o.ResponseTypes == nil { + if o == nil || IsNil(o.ResponseTypes) { return nil, false } return o.ResponseTypes, true @@ -1361,7 +1364,7 @@ func (o *OAuth2Client) GetResponseTypesOk() ([]string, bool) { // HasResponseTypes returns a boolean if a field has been set. func (o *OAuth2Client) HasResponseTypes() bool { - if o != nil && o.ResponseTypes != nil { + if o != nil && !IsNil(o.ResponseTypes) { return true } @@ -1375,7 +1378,7 @@ func (o *OAuth2Client) SetResponseTypes(v []string) { // GetScope returns the Scope field value if set, zero value otherwise. func (o *OAuth2Client) GetScope() string { - if o == nil || o.Scope == nil { + if o == nil || IsNil(o.Scope) { var ret string return ret } @@ -1385,7 +1388,7 @@ func (o *OAuth2Client) GetScope() string { // GetScopeOk returns a tuple with the Scope field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetScopeOk() (*string, bool) { - if o == nil || o.Scope == nil { + if o == nil || IsNil(o.Scope) { return nil, false } return o.Scope, true @@ -1393,7 +1396,7 @@ func (o *OAuth2Client) GetScopeOk() (*string, bool) { // HasScope returns a boolean if a field has been set. func (o *OAuth2Client) HasScope() bool { - if o != nil && o.Scope != nil { + if o != nil && !IsNil(o.Scope) { return true } @@ -1407,7 +1410,7 @@ func (o *OAuth2Client) SetScope(v string) { // GetSectorIdentifierUri returns the SectorIdentifierUri field value if set, zero value otherwise. func (o *OAuth2Client) GetSectorIdentifierUri() string { - if o == nil || o.SectorIdentifierUri == nil { + if o == nil || IsNil(o.SectorIdentifierUri) { var ret string return ret } @@ -1417,7 +1420,7 @@ func (o *OAuth2Client) GetSectorIdentifierUri() string { // GetSectorIdentifierUriOk returns a tuple with the SectorIdentifierUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetSectorIdentifierUriOk() (*string, bool) { - if o == nil || o.SectorIdentifierUri == nil { + if o == nil || IsNil(o.SectorIdentifierUri) { return nil, false } return o.SectorIdentifierUri, true @@ -1425,7 +1428,7 @@ func (o *OAuth2Client) GetSectorIdentifierUriOk() (*string, bool) { // HasSectorIdentifierUri returns a boolean if a field has been set. func (o *OAuth2Client) HasSectorIdentifierUri() bool { - if o != nil && o.SectorIdentifierUri != nil { + if o != nil && !IsNil(o.SectorIdentifierUri) { return true } @@ -1439,7 +1442,7 @@ func (o *OAuth2Client) SetSectorIdentifierUri(v string) { // GetSkipConsent returns the SkipConsent field value if set, zero value otherwise. func (o *OAuth2Client) GetSkipConsent() bool { - if o == nil || o.SkipConsent == nil { + if o == nil || IsNil(o.SkipConsent) { var ret bool return ret } @@ -1449,7 +1452,7 @@ func (o *OAuth2Client) GetSkipConsent() bool { // GetSkipConsentOk returns a tuple with the SkipConsent field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetSkipConsentOk() (*bool, bool) { - if o == nil || o.SkipConsent == nil { + if o == nil || IsNil(o.SkipConsent) { return nil, false } return o.SkipConsent, true @@ -1457,7 +1460,7 @@ func (o *OAuth2Client) GetSkipConsentOk() (*bool, bool) { // HasSkipConsent returns a boolean if a field has been set. func (o *OAuth2Client) HasSkipConsent() bool { - if o != nil && o.SkipConsent != nil { + if o != nil && !IsNil(o.SkipConsent) { return true } @@ -1471,7 +1474,7 @@ func (o *OAuth2Client) SetSkipConsent(v bool) { // GetSubjectType returns the SubjectType field value if set, zero value otherwise. func (o *OAuth2Client) GetSubjectType() string { - if o == nil || o.SubjectType == nil { + if o == nil || IsNil(o.SubjectType) { var ret string return ret } @@ -1481,7 +1484,7 @@ func (o *OAuth2Client) GetSubjectType() string { // GetSubjectTypeOk returns a tuple with the SubjectType field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetSubjectTypeOk() (*string, bool) { - if o == nil || o.SubjectType == nil { + if o == nil || IsNil(o.SubjectType) { return nil, false } return o.SubjectType, true @@ -1489,7 +1492,7 @@ func (o *OAuth2Client) GetSubjectTypeOk() (*string, bool) { // HasSubjectType returns a boolean if a field has been set. func (o *OAuth2Client) HasSubjectType() bool { - if o != nil && o.SubjectType != nil { + if o != nil && !IsNil(o.SubjectType) { return true } @@ -1503,7 +1506,7 @@ func (o *OAuth2Client) SetSubjectType(v string) { // GetTokenEndpointAuthMethod returns the TokenEndpointAuthMethod field value if set, zero value otherwise. func (o *OAuth2Client) GetTokenEndpointAuthMethod() string { - if o == nil || o.TokenEndpointAuthMethod == nil { + if o == nil || IsNil(o.TokenEndpointAuthMethod) { var ret string return ret } @@ -1513,7 +1516,7 @@ func (o *OAuth2Client) GetTokenEndpointAuthMethod() string { // GetTokenEndpointAuthMethodOk returns a tuple with the TokenEndpointAuthMethod field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetTokenEndpointAuthMethodOk() (*string, bool) { - if o == nil || o.TokenEndpointAuthMethod == nil { + if o == nil || IsNil(o.TokenEndpointAuthMethod) { return nil, false } return o.TokenEndpointAuthMethod, true @@ -1521,7 +1524,7 @@ func (o *OAuth2Client) GetTokenEndpointAuthMethodOk() (*string, bool) { // HasTokenEndpointAuthMethod returns a boolean if a field has been set. func (o *OAuth2Client) HasTokenEndpointAuthMethod() bool { - if o != nil && o.TokenEndpointAuthMethod != nil { + if o != nil && !IsNil(o.TokenEndpointAuthMethod) { return true } @@ -1535,7 +1538,7 @@ func (o *OAuth2Client) SetTokenEndpointAuthMethod(v string) { // GetTokenEndpointAuthSigningAlg returns the TokenEndpointAuthSigningAlg field value if set, zero value otherwise. func (o *OAuth2Client) GetTokenEndpointAuthSigningAlg() string { - if o == nil || o.TokenEndpointAuthSigningAlg == nil { + if o == nil || IsNil(o.TokenEndpointAuthSigningAlg) { var ret string return ret } @@ -1545,7 +1548,7 @@ func (o *OAuth2Client) GetTokenEndpointAuthSigningAlg() string { // GetTokenEndpointAuthSigningAlgOk returns a tuple with the TokenEndpointAuthSigningAlg field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetTokenEndpointAuthSigningAlgOk() (*string, bool) { - if o == nil || o.TokenEndpointAuthSigningAlg == nil { + if o == nil || IsNil(o.TokenEndpointAuthSigningAlg) { return nil, false } return o.TokenEndpointAuthSigningAlg, true @@ -1553,7 +1556,7 @@ func (o *OAuth2Client) GetTokenEndpointAuthSigningAlgOk() (*string, bool) { // HasTokenEndpointAuthSigningAlg returns a boolean if a field has been set. func (o *OAuth2Client) HasTokenEndpointAuthSigningAlg() bool { - if o != nil && o.TokenEndpointAuthSigningAlg != nil { + if o != nil && !IsNil(o.TokenEndpointAuthSigningAlg) { return true } @@ -1567,7 +1570,7 @@ func (o *OAuth2Client) SetTokenEndpointAuthSigningAlg(v string) { // GetTosUri returns the TosUri field value if set, zero value otherwise. func (o *OAuth2Client) GetTosUri() string { - if o == nil || o.TosUri == nil { + if o == nil || IsNil(o.TosUri) { var ret string return ret } @@ -1577,7 +1580,7 @@ func (o *OAuth2Client) GetTosUri() string { // GetTosUriOk returns a tuple with the TosUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetTosUriOk() (*string, bool) { - if o == nil || o.TosUri == nil { + if o == nil || IsNil(o.TosUri) { return nil, false } return o.TosUri, true @@ -1585,7 +1588,7 @@ func (o *OAuth2Client) GetTosUriOk() (*string, bool) { // HasTosUri returns a boolean if a field has been set. func (o *OAuth2Client) HasTosUri() bool { - if o != nil && o.TosUri != nil { + if o != nil && !IsNil(o.TosUri) { return true } @@ -1599,7 +1602,7 @@ func (o *OAuth2Client) SetTosUri(v string) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *OAuth2Client) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -1609,7 +1612,7 @@ func (o *OAuth2Client) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -1617,7 +1620,7 @@ func (o *OAuth2Client) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *OAuth2Client) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -1631,7 +1634,7 @@ func (o *OAuth2Client) SetUpdatedAt(v time.Time) { // GetUserinfoSignedResponseAlg returns the UserinfoSignedResponseAlg field value if set, zero value otherwise. func (o *OAuth2Client) GetUserinfoSignedResponseAlg() string { - if o == nil || o.UserinfoSignedResponseAlg == nil { + if o == nil || IsNil(o.UserinfoSignedResponseAlg) { var ret string return ret } @@ -1641,7 +1644,7 @@ func (o *OAuth2Client) GetUserinfoSignedResponseAlg() string { // GetUserinfoSignedResponseAlgOk returns a tuple with the UserinfoSignedResponseAlg field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2Client) GetUserinfoSignedResponseAlgOk() (*string, bool) { - if o == nil || o.UserinfoSignedResponseAlg == nil { + if o == nil || IsNil(o.UserinfoSignedResponseAlg) { return nil, false } return o.UserinfoSignedResponseAlg, true @@ -1649,7 +1652,7 @@ func (o *OAuth2Client) GetUserinfoSignedResponseAlgOk() (*string, bool) { // HasUserinfoSignedResponseAlg returns a boolean if a field has been set. func (o *OAuth2Client) HasUserinfoSignedResponseAlg() bool { - if o != nil && o.UserinfoSignedResponseAlg != nil { + if o != nil && !IsNil(o.UserinfoSignedResponseAlg) { return true } @@ -1662,152 +1665,160 @@ func (o *OAuth2Client) SetUserinfoSignedResponseAlg(v string) { } func (o OAuth2Client) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OAuth2Client) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.AdditionalPropertiesField != nil { + if !IsNil(o.AdditionalPropertiesField) { toSerialize["AdditionalProperties"] = o.AdditionalPropertiesField } - if o.AccessTokenStrategy != nil { + if !IsNil(o.AccessTokenStrategy) { toSerialize["access_token_strategy"] = o.AccessTokenStrategy } - if o.AllowedCorsOrigins != nil { + if !IsNil(o.AllowedCorsOrigins) { toSerialize["allowed_cors_origins"] = o.AllowedCorsOrigins } - if o.Audience != nil { + if !IsNil(o.Audience) { toSerialize["audience"] = o.Audience } - if o.AuthorizationCodeGrantAccessTokenLifespan != nil { + if !IsNil(o.AuthorizationCodeGrantAccessTokenLifespan) { toSerialize["authorization_code_grant_access_token_lifespan"] = o.AuthorizationCodeGrantAccessTokenLifespan } - if o.AuthorizationCodeGrantIdTokenLifespan != nil { + if !IsNil(o.AuthorizationCodeGrantIdTokenLifespan) { toSerialize["authorization_code_grant_id_token_lifespan"] = o.AuthorizationCodeGrantIdTokenLifespan } - if o.AuthorizationCodeGrantRefreshTokenLifespan != nil { + if !IsNil(o.AuthorizationCodeGrantRefreshTokenLifespan) { toSerialize["authorization_code_grant_refresh_token_lifespan"] = o.AuthorizationCodeGrantRefreshTokenLifespan } - if o.BackchannelLogoutSessionRequired != nil { + if !IsNil(o.BackchannelLogoutSessionRequired) { toSerialize["backchannel_logout_session_required"] = o.BackchannelLogoutSessionRequired } - if o.BackchannelLogoutUri != nil { + if !IsNil(o.BackchannelLogoutUri) { toSerialize["backchannel_logout_uri"] = o.BackchannelLogoutUri } - if o.ClientCredentialsGrantAccessTokenLifespan != nil { + if !IsNil(o.ClientCredentialsGrantAccessTokenLifespan) { toSerialize["client_credentials_grant_access_token_lifespan"] = o.ClientCredentialsGrantAccessTokenLifespan } - if o.ClientId != nil { + if !IsNil(o.ClientId) { toSerialize["client_id"] = o.ClientId } - if o.ClientName != nil { + if !IsNil(o.ClientName) { toSerialize["client_name"] = o.ClientName } - if o.ClientSecret != nil { + if !IsNil(o.ClientSecret) { toSerialize["client_secret"] = o.ClientSecret } - if o.ClientSecretExpiresAt != nil { + if !IsNil(o.ClientSecretExpiresAt) { toSerialize["client_secret_expires_at"] = o.ClientSecretExpiresAt } - if o.ClientUri != nil { + if !IsNil(o.ClientUri) { toSerialize["client_uri"] = o.ClientUri } - if o.Contacts != nil { + if !IsNil(o.Contacts) { toSerialize["contacts"] = o.Contacts } - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if o.FrontchannelLogoutSessionRequired != nil { + if !IsNil(o.FrontchannelLogoutSessionRequired) { toSerialize["frontchannel_logout_session_required"] = o.FrontchannelLogoutSessionRequired } - if o.FrontchannelLogoutUri != nil { + if !IsNil(o.FrontchannelLogoutUri) { toSerialize["frontchannel_logout_uri"] = o.FrontchannelLogoutUri } - if o.GrantTypes != nil { + if !IsNil(o.GrantTypes) { toSerialize["grant_types"] = o.GrantTypes } - if o.ImplicitGrantAccessTokenLifespan != nil { + if !IsNil(o.ImplicitGrantAccessTokenLifespan) { toSerialize["implicit_grant_access_token_lifespan"] = o.ImplicitGrantAccessTokenLifespan } - if o.ImplicitGrantIdTokenLifespan != nil { + if !IsNil(o.ImplicitGrantIdTokenLifespan) { toSerialize["implicit_grant_id_token_lifespan"] = o.ImplicitGrantIdTokenLifespan } if o.Jwks != nil { toSerialize["jwks"] = o.Jwks } - if o.JwksUri != nil { + if !IsNil(o.JwksUri) { toSerialize["jwks_uri"] = o.JwksUri } - if o.JwtBearerGrantAccessTokenLifespan != nil { + if !IsNil(o.JwtBearerGrantAccessTokenLifespan) { toSerialize["jwt_bearer_grant_access_token_lifespan"] = o.JwtBearerGrantAccessTokenLifespan } - if o.LogoUri != nil { + if !IsNil(o.LogoUri) { toSerialize["logo_uri"] = o.LogoUri } if o.Metadata != nil { toSerialize["metadata"] = o.Metadata } - if o.Owner != nil { + if !IsNil(o.Owner) { toSerialize["owner"] = o.Owner } - if o.PolicyUri != nil { + if !IsNil(o.PolicyUri) { toSerialize["policy_uri"] = o.PolicyUri } - if o.PostLogoutRedirectUris != nil { + if !IsNil(o.PostLogoutRedirectUris) { toSerialize["post_logout_redirect_uris"] = o.PostLogoutRedirectUris } - if o.RedirectUris != nil { + if !IsNil(o.RedirectUris) { toSerialize["redirect_uris"] = o.RedirectUris } - if o.RefreshTokenGrantAccessTokenLifespan != nil { + if !IsNil(o.RefreshTokenGrantAccessTokenLifespan) { toSerialize["refresh_token_grant_access_token_lifespan"] = o.RefreshTokenGrantAccessTokenLifespan } - if o.RefreshTokenGrantIdTokenLifespan != nil { + if !IsNil(o.RefreshTokenGrantIdTokenLifespan) { toSerialize["refresh_token_grant_id_token_lifespan"] = o.RefreshTokenGrantIdTokenLifespan } - if o.RefreshTokenGrantRefreshTokenLifespan != nil { + if !IsNil(o.RefreshTokenGrantRefreshTokenLifespan) { toSerialize["refresh_token_grant_refresh_token_lifespan"] = o.RefreshTokenGrantRefreshTokenLifespan } - if o.RegistrationAccessToken != nil { + if !IsNil(o.RegistrationAccessToken) { toSerialize["registration_access_token"] = o.RegistrationAccessToken } - if o.RegistrationClientUri != nil { + if !IsNil(o.RegistrationClientUri) { toSerialize["registration_client_uri"] = o.RegistrationClientUri } - if o.RequestObjectSigningAlg != nil { + if !IsNil(o.RequestObjectSigningAlg) { toSerialize["request_object_signing_alg"] = o.RequestObjectSigningAlg } - if o.RequestUris != nil { + if !IsNil(o.RequestUris) { toSerialize["request_uris"] = o.RequestUris } - if o.ResponseTypes != nil { + if !IsNil(o.ResponseTypes) { toSerialize["response_types"] = o.ResponseTypes } - if o.Scope != nil { + if !IsNil(o.Scope) { toSerialize["scope"] = o.Scope } - if o.SectorIdentifierUri != nil { + if !IsNil(o.SectorIdentifierUri) { toSerialize["sector_identifier_uri"] = o.SectorIdentifierUri } - if o.SkipConsent != nil { + if !IsNil(o.SkipConsent) { toSerialize["skip_consent"] = o.SkipConsent } - if o.SubjectType != nil { + if !IsNil(o.SubjectType) { toSerialize["subject_type"] = o.SubjectType } - if o.TokenEndpointAuthMethod != nil { + if !IsNil(o.TokenEndpointAuthMethod) { toSerialize["token_endpoint_auth_method"] = o.TokenEndpointAuthMethod } - if o.TokenEndpointAuthSigningAlg != nil { + if !IsNil(o.TokenEndpointAuthSigningAlg) { toSerialize["token_endpoint_auth_signing_alg"] = o.TokenEndpointAuthSigningAlg } - if o.TosUri != nil { + if !IsNil(o.TosUri) { toSerialize["tos_uri"] = o.TosUri } - if o.UpdatedAt != nil { + if !IsNil(o.UpdatedAt) { toSerialize["updated_at"] = o.UpdatedAt } - if o.UserinfoSignedResponseAlg != nil { + if !IsNil(o.UserinfoSignedResponseAlg) { toSerialize["userinfo_signed_response_alg"] = o.UserinfoSignedResponseAlg } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableOAuth2Client struct { diff --git a/internal/httpclient/model_o_auth2_consent_request_open_id_connect_context.go b/internal/httpclient/model_o_auth2_consent_request_open_id_connect_context.go index 68884830a9ee..8daf562f15f2 100644 --- a/internal/httpclient/model_o_auth2_consent_request_open_id_connect_context.go +++ b/internal/httpclient/model_o_auth2_consent_request_open_id_connect_context.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the OAuth2ConsentRequestOpenIDConnectContext type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OAuth2ConsentRequestOpenIDConnectContext{} + // OAuth2ConsentRequestOpenIDConnectContext OAuth2ConsentRequestOpenIDConnectContext struct for OAuth2ConsentRequestOpenIDConnectContext type OAuth2ConsentRequestOpenIDConnectContext struct { AdditionalPropertiesField map[string]interface{} `json:"AdditionalProperties,omitempty"` @@ -49,7 +52,7 @@ func NewOAuth2ConsentRequestOpenIDConnectContextWithDefaults() *OAuth2ConsentReq // GetAdditionalPropertiesField returns the AdditionalPropertiesField field value if set, zero value otherwise. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAdditionalPropertiesField() map[string]interface{} { - if o == nil || o.AdditionalPropertiesField == nil { + if o == nil || IsNil(o.AdditionalPropertiesField) { var ret map[string]interface{} return ret } @@ -59,15 +62,15 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAdditionalPropertiesField( // GetAdditionalPropertiesFieldOk returns a tuple with the AdditionalPropertiesField field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAdditionalPropertiesFieldOk() (map[string]interface{}, bool) { - if o == nil || o.AdditionalPropertiesField == nil { - return nil, false + if o == nil || IsNil(o.AdditionalPropertiesField) { + return map[string]interface{}{}, false } return o.AdditionalPropertiesField, true } // HasAdditionalPropertiesField returns a boolean if a field has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) HasAdditionalPropertiesField() bool { - if o != nil && o.AdditionalPropertiesField != nil { + if o != nil && !IsNil(o.AdditionalPropertiesField) { return true } @@ -81,7 +84,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) SetAdditionalPropertiesField( // GetAcrValues returns the AcrValues field value if set, zero value otherwise. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAcrValues() []string { - if o == nil || o.AcrValues == nil { + if o == nil || IsNil(o.AcrValues) { var ret []string return ret } @@ -91,7 +94,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAcrValues() []string { // GetAcrValuesOk returns a tuple with the AcrValues field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAcrValuesOk() ([]string, bool) { - if o == nil || o.AcrValues == nil { + if o == nil || IsNil(o.AcrValues) { return nil, false } return o.AcrValues, true @@ -99,7 +102,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetAcrValuesOk() ([]string, b // HasAcrValues returns a boolean if a field has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) HasAcrValues() bool { - if o != nil && o.AcrValues != nil { + if o != nil && !IsNil(o.AcrValues) { return true } @@ -113,7 +116,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) SetAcrValues(v []string) { // GetDisplay returns the Display field value if set, zero value otherwise. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetDisplay() string { - if o == nil || o.Display == nil { + if o == nil || IsNil(o.Display) { var ret string return ret } @@ -123,7 +126,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetDisplay() string { // GetDisplayOk returns a tuple with the Display field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetDisplayOk() (*string, bool) { - if o == nil || o.Display == nil { + if o == nil || IsNil(o.Display) { return nil, false } return o.Display, true @@ -131,7 +134,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetDisplayOk() (*string, bool // HasDisplay returns a boolean if a field has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) HasDisplay() bool { - if o != nil && o.Display != nil { + if o != nil && !IsNil(o.Display) { return true } @@ -145,7 +148,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) SetDisplay(v string) { // GetIdTokenHintClaims returns the IdTokenHintClaims field value if set, zero value otherwise. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetIdTokenHintClaims() map[string]interface{} { - if o == nil || o.IdTokenHintClaims == nil { + if o == nil || IsNil(o.IdTokenHintClaims) { var ret map[string]interface{} return ret } @@ -155,15 +158,15 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetIdTokenHintClaims() map[st // GetIdTokenHintClaimsOk returns a tuple with the IdTokenHintClaims field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetIdTokenHintClaimsOk() (map[string]interface{}, bool) { - if o == nil || o.IdTokenHintClaims == nil { - return nil, false + if o == nil || IsNil(o.IdTokenHintClaims) { + return map[string]interface{}{}, false } return o.IdTokenHintClaims, true } // HasIdTokenHintClaims returns a boolean if a field has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) HasIdTokenHintClaims() bool { - if o != nil && o.IdTokenHintClaims != nil { + if o != nil && !IsNil(o.IdTokenHintClaims) { return true } @@ -177,7 +180,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) SetIdTokenHintClaims(v map[st // GetLoginHint returns the LoginHint field value if set, zero value otherwise. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetLoginHint() string { - if o == nil || o.LoginHint == nil { + if o == nil || IsNil(o.LoginHint) { var ret string return ret } @@ -187,7 +190,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetLoginHint() string { // GetLoginHintOk returns a tuple with the LoginHint field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetLoginHintOk() (*string, bool) { - if o == nil || o.LoginHint == nil { + if o == nil || IsNil(o.LoginHint) { return nil, false } return o.LoginHint, true @@ -195,7 +198,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetLoginHintOk() (*string, bo // HasLoginHint returns a boolean if a field has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) HasLoginHint() bool { - if o != nil && o.LoginHint != nil { + if o != nil && !IsNil(o.LoginHint) { return true } @@ -209,7 +212,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) SetLoginHint(v string) { // GetUiLocales returns the UiLocales field value if set, zero value otherwise. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetUiLocales() []string { - if o == nil || o.UiLocales == nil { + if o == nil || IsNil(o.UiLocales) { var ret []string return ret } @@ -219,7 +222,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetUiLocales() []string { // GetUiLocalesOk returns a tuple with the UiLocales field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) GetUiLocalesOk() ([]string, bool) { - if o == nil || o.UiLocales == nil { + if o == nil || IsNil(o.UiLocales) { return nil, false } return o.UiLocales, true @@ -227,7 +230,7 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) GetUiLocalesOk() ([]string, b // HasUiLocales returns a boolean if a field has been set. func (o *OAuth2ConsentRequestOpenIDConnectContext) HasUiLocales() bool { - if o != nil && o.UiLocales != nil { + if o != nil && !IsNil(o.UiLocales) { return true } @@ -240,26 +243,34 @@ func (o *OAuth2ConsentRequestOpenIDConnectContext) SetUiLocales(v []string) { } func (o OAuth2ConsentRequestOpenIDConnectContext) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OAuth2ConsentRequestOpenIDConnectContext) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.AdditionalPropertiesField != nil { + if !IsNil(o.AdditionalPropertiesField) { toSerialize["AdditionalProperties"] = o.AdditionalPropertiesField } - if o.AcrValues != nil { + if !IsNil(o.AcrValues) { toSerialize["acr_values"] = o.AcrValues } - if o.Display != nil { + if !IsNil(o.Display) { toSerialize["display"] = o.Display } - if o.IdTokenHintClaims != nil { + if !IsNil(o.IdTokenHintClaims) { toSerialize["id_token_hint_claims"] = o.IdTokenHintClaims } - if o.LoginHint != nil { + if !IsNil(o.LoginHint) { toSerialize["login_hint"] = o.LoginHint } - if o.UiLocales != nil { + if !IsNil(o.UiLocales) { toSerialize["ui_locales"] = o.UiLocales } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableOAuth2ConsentRequestOpenIDConnectContext struct { diff --git a/internal/httpclient/model_o_auth2_login_request.go b/internal/httpclient/model_o_auth2_login_request.go index a788c66ed3ca..8584a570e6b9 100644 --- a/internal/httpclient/model_o_auth2_login_request.go +++ b/internal/httpclient/model_o_auth2_login_request.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the OAuth2LoginRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OAuth2LoginRequest{} + // OAuth2LoginRequest OAuth2LoginRequest struct for OAuth2LoginRequest type OAuth2LoginRequest struct { AdditionalPropertiesField map[string]interface{} `json:"AdditionalProperties,omitempty"` @@ -53,7 +56,7 @@ func NewOAuth2LoginRequestWithDefaults() *OAuth2LoginRequest { // GetAdditionalPropertiesField returns the AdditionalPropertiesField field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetAdditionalPropertiesField() map[string]interface{} { - if o == nil || o.AdditionalPropertiesField == nil { + if o == nil || IsNil(o.AdditionalPropertiesField) { var ret map[string]interface{} return ret } @@ -63,15 +66,15 @@ func (o *OAuth2LoginRequest) GetAdditionalPropertiesField() map[string]interface // GetAdditionalPropertiesFieldOk returns a tuple with the AdditionalPropertiesField field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetAdditionalPropertiesFieldOk() (map[string]interface{}, bool) { - if o == nil || o.AdditionalPropertiesField == nil { - return nil, false + if o == nil || IsNil(o.AdditionalPropertiesField) { + return map[string]interface{}{}, false } return o.AdditionalPropertiesField, true } // HasAdditionalPropertiesField returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasAdditionalPropertiesField() bool { - if o != nil && o.AdditionalPropertiesField != nil { + if o != nil && !IsNil(o.AdditionalPropertiesField) { return true } @@ -85,7 +88,7 @@ func (o *OAuth2LoginRequest) SetAdditionalPropertiesField(v map[string]interface // GetChallenge returns the Challenge field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetChallenge() string { - if o == nil || o.Challenge == nil { + if o == nil || IsNil(o.Challenge) { var ret string return ret } @@ -95,7 +98,7 @@ func (o *OAuth2LoginRequest) GetChallenge() string { // GetChallengeOk returns a tuple with the Challenge field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetChallengeOk() (*string, bool) { - if o == nil || o.Challenge == nil { + if o == nil || IsNil(o.Challenge) { return nil, false } return o.Challenge, true @@ -103,7 +106,7 @@ func (o *OAuth2LoginRequest) GetChallengeOk() (*string, bool) { // HasChallenge returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasChallenge() bool { - if o != nil && o.Challenge != nil { + if o != nil && !IsNil(o.Challenge) { return true } @@ -117,7 +120,7 @@ func (o *OAuth2LoginRequest) SetChallenge(v string) { // GetClient returns the Client field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetClient() OAuth2Client { - if o == nil || o.Client == nil { + if o == nil || IsNil(o.Client) { var ret OAuth2Client return ret } @@ -127,7 +130,7 @@ func (o *OAuth2LoginRequest) GetClient() OAuth2Client { // GetClientOk returns a tuple with the Client field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetClientOk() (*OAuth2Client, bool) { - if o == nil || o.Client == nil { + if o == nil || IsNil(o.Client) { return nil, false } return o.Client, true @@ -135,7 +138,7 @@ func (o *OAuth2LoginRequest) GetClientOk() (*OAuth2Client, bool) { // HasClient returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasClient() bool { - if o != nil && o.Client != nil { + if o != nil && !IsNil(o.Client) { return true } @@ -149,7 +152,7 @@ func (o *OAuth2LoginRequest) SetClient(v OAuth2Client) { // GetOidcContext returns the OidcContext field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetOidcContext() OAuth2ConsentRequestOpenIDConnectContext { - if o == nil || o.OidcContext == nil { + if o == nil || IsNil(o.OidcContext) { var ret OAuth2ConsentRequestOpenIDConnectContext return ret } @@ -159,7 +162,7 @@ func (o *OAuth2LoginRequest) GetOidcContext() OAuth2ConsentRequestOpenIDConnectC // GetOidcContextOk returns a tuple with the OidcContext field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetOidcContextOk() (*OAuth2ConsentRequestOpenIDConnectContext, bool) { - if o == nil || o.OidcContext == nil { + if o == nil || IsNil(o.OidcContext) { return nil, false } return o.OidcContext, true @@ -167,7 +170,7 @@ func (o *OAuth2LoginRequest) GetOidcContextOk() (*OAuth2ConsentRequestOpenIDConn // HasOidcContext returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasOidcContext() bool { - if o != nil && o.OidcContext != nil { + if o != nil && !IsNil(o.OidcContext) { return true } @@ -181,7 +184,7 @@ func (o *OAuth2LoginRequest) SetOidcContext(v OAuth2ConsentRequestOpenIDConnectC // GetRequestUrl returns the RequestUrl field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetRequestUrl() string { - if o == nil || o.RequestUrl == nil { + if o == nil || IsNil(o.RequestUrl) { var ret string return ret } @@ -191,7 +194,7 @@ func (o *OAuth2LoginRequest) GetRequestUrl() string { // GetRequestUrlOk returns a tuple with the RequestUrl field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetRequestUrlOk() (*string, bool) { - if o == nil || o.RequestUrl == nil { + if o == nil || IsNil(o.RequestUrl) { return nil, false } return o.RequestUrl, true @@ -199,7 +202,7 @@ func (o *OAuth2LoginRequest) GetRequestUrlOk() (*string, bool) { // HasRequestUrl returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasRequestUrl() bool { - if o != nil && o.RequestUrl != nil { + if o != nil && !IsNil(o.RequestUrl) { return true } @@ -213,7 +216,7 @@ func (o *OAuth2LoginRequest) SetRequestUrl(v string) { // GetRequestedAccessTokenAudience returns the RequestedAccessTokenAudience field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetRequestedAccessTokenAudience() []string { - if o == nil || o.RequestedAccessTokenAudience == nil { + if o == nil || IsNil(o.RequestedAccessTokenAudience) { var ret []string return ret } @@ -223,7 +226,7 @@ func (o *OAuth2LoginRequest) GetRequestedAccessTokenAudience() []string { // GetRequestedAccessTokenAudienceOk returns a tuple with the RequestedAccessTokenAudience field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetRequestedAccessTokenAudienceOk() ([]string, bool) { - if o == nil || o.RequestedAccessTokenAudience == nil { + if o == nil || IsNil(o.RequestedAccessTokenAudience) { return nil, false } return o.RequestedAccessTokenAudience, true @@ -231,7 +234,7 @@ func (o *OAuth2LoginRequest) GetRequestedAccessTokenAudienceOk() ([]string, bool // HasRequestedAccessTokenAudience returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasRequestedAccessTokenAudience() bool { - if o != nil && o.RequestedAccessTokenAudience != nil { + if o != nil && !IsNil(o.RequestedAccessTokenAudience) { return true } @@ -245,7 +248,7 @@ func (o *OAuth2LoginRequest) SetRequestedAccessTokenAudience(v []string) { // GetRequestedScope returns the RequestedScope field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetRequestedScope() []string { - if o == nil || o.RequestedScope == nil { + if o == nil || IsNil(o.RequestedScope) { var ret []string return ret } @@ -255,7 +258,7 @@ func (o *OAuth2LoginRequest) GetRequestedScope() []string { // GetRequestedScopeOk returns a tuple with the RequestedScope field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetRequestedScopeOk() ([]string, bool) { - if o == nil || o.RequestedScope == nil { + if o == nil || IsNil(o.RequestedScope) { return nil, false } return o.RequestedScope, true @@ -263,7 +266,7 @@ func (o *OAuth2LoginRequest) GetRequestedScopeOk() ([]string, bool) { // HasRequestedScope returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasRequestedScope() bool { - if o != nil && o.RequestedScope != nil { + if o != nil && !IsNil(o.RequestedScope) { return true } @@ -277,7 +280,7 @@ func (o *OAuth2LoginRequest) SetRequestedScope(v []string) { // GetSessionId returns the SessionId field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetSessionId() string { - if o == nil || o.SessionId == nil { + if o == nil || IsNil(o.SessionId) { var ret string return ret } @@ -287,7 +290,7 @@ func (o *OAuth2LoginRequest) GetSessionId() string { // GetSessionIdOk returns a tuple with the SessionId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetSessionIdOk() (*string, bool) { - if o == nil || o.SessionId == nil { + if o == nil || IsNil(o.SessionId) { return nil, false } return o.SessionId, true @@ -295,7 +298,7 @@ func (o *OAuth2LoginRequest) GetSessionIdOk() (*string, bool) { // HasSessionId returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasSessionId() bool { - if o != nil && o.SessionId != nil { + if o != nil && !IsNil(o.SessionId) { return true } @@ -309,7 +312,7 @@ func (o *OAuth2LoginRequest) SetSessionId(v string) { // GetSkip returns the Skip field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetSkip() bool { - if o == nil || o.Skip == nil { + if o == nil || IsNil(o.Skip) { var ret bool return ret } @@ -319,7 +322,7 @@ func (o *OAuth2LoginRequest) GetSkip() bool { // GetSkipOk returns a tuple with the Skip field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetSkipOk() (*bool, bool) { - if o == nil || o.Skip == nil { + if o == nil || IsNil(o.Skip) { return nil, false } return o.Skip, true @@ -327,7 +330,7 @@ func (o *OAuth2LoginRequest) GetSkipOk() (*bool, bool) { // HasSkip returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasSkip() bool { - if o != nil && o.Skip != nil { + if o != nil && !IsNil(o.Skip) { return true } @@ -341,7 +344,7 @@ func (o *OAuth2LoginRequest) SetSkip(v bool) { // GetSubject returns the Subject field value if set, zero value otherwise. func (o *OAuth2LoginRequest) GetSubject() string { - if o == nil || o.Subject == nil { + if o == nil || IsNil(o.Subject) { var ret string return ret } @@ -351,7 +354,7 @@ func (o *OAuth2LoginRequest) GetSubject() string { // GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *OAuth2LoginRequest) GetSubjectOk() (*string, bool) { - if o == nil || o.Subject == nil { + if o == nil || IsNil(o.Subject) { return nil, false } return o.Subject, true @@ -359,7 +362,7 @@ func (o *OAuth2LoginRequest) GetSubjectOk() (*string, bool) { // HasSubject returns a boolean if a field has been set. func (o *OAuth2LoginRequest) HasSubject() bool { - if o != nil && o.Subject != nil { + if o != nil && !IsNil(o.Subject) { return true } @@ -372,38 +375,46 @@ func (o *OAuth2LoginRequest) SetSubject(v string) { } func (o OAuth2LoginRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OAuth2LoginRequest) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.AdditionalPropertiesField != nil { + if !IsNil(o.AdditionalPropertiesField) { toSerialize["AdditionalProperties"] = o.AdditionalPropertiesField } - if o.Challenge != nil { + if !IsNil(o.Challenge) { toSerialize["challenge"] = o.Challenge } - if o.Client != nil { + if !IsNil(o.Client) { toSerialize["client"] = o.Client } - if o.OidcContext != nil { + if !IsNil(o.OidcContext) { toSerialize["oidc_context"] = o.OidcContext } - if o.RequestUrl != nil { + if !IsNil(o.RequestUrl) { toSerialize["request_url"] = o.RequestUrl } - if o.RequestedAccessTokenAudience != nil { + if !IsNil(o.RequestedAccessTokenAudience) { toSerialize["requested_access_token_audience"] = o.RequestedAccessTokenAudience } - if o.RequestedScope != nil { + if !IsNil(o.RequestedScope) { toSerialize["requested_scope"] = o.RequestedScope } - if o.SessionId != nil { + if !IsNil(o.SessionId) { toSerialize["session_id"] = o.SessionId } - if o.Skip != nil { + if !IsNil(o.Skip) { toSerialize["skip"] = o.Skip } - if o.Subject != nil { + if !IsNil(o.Subject) { toSerialize["subject"] = o.Subject } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableOAuth2LoginRequest struct { diff --git a/internal/httpclient/model_patch_identities_body.go b/internal/httpclient/model_patch_identities_body.go index 01ea4833c924..91930e65b743 100644 --- a/internal/httpclient/model_patch_identities_body.go +++ b/internal/httpclient/model_patch_identities_body.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the PatchIdentitiesBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchIdentitiesBody{} + // PatchIdentitiesBody Patch Identities Body type PatchIdentitiesBody struct { // Identities holds the list of patches to apply required @@ -40,7 +43,7 @@ func NewPatchIdentitiesBodyWithDefaults() *PatchIdentitiesBody { // GetIdentities returns the Identities field value if set, zero value otherwise. func (o *PatchIdentitiesBody) GetIdentities() []IdentityPatch { - if o == nil || o.Identities == nil { + if o == nil || IsNil(o.Identities) { var ret []IdentityPatch return ret } @@ -50,7 +53,7 @@ func (o *PatchIdentitiesBody) GetIdentities() []IdentityPatch { // GetIdentitiesOk returns a tuple with the Identities field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PatchIdentitiesBody) GetIdentitiesOk() ([]IdentityPatch, bool) { - if o == nil || o.Identities == nil { + if o == nil || IsNil(o.Identities) { return nil, false } return o.Identities, true @@ -58,7 +61,7 @@ func (o *PatchIdentitiesBody) GetIdentitiesOk() ([]IdentityPatch, bool) { // HasIdentities returns a boolean if a field has been set. func (o *PatchIdentitiesBody) HasIdentities() bool { - if o != nil && o.Identities != nil { + if o != nil && !IsNil(o.Identities) { return true } @@ -71,11 +74,19 @@ func (o *PatchIdentitiesBody) SetIdentities(v []IdentityPatch) { } func (o PatchIdentitiesBody) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PatchIdentitiesBody) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Identities != nil { + if !IsNil(o.Identities) { toSerialize["identities"] = o.Identities } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullablePatchIdentitiesBody struct { diff --git a/internal/httpclient/model_perform_native_logout_body.go b/internal/httpclient/model_perform_native_logout_body.go index 81d65f11a7c1..d62372095eef 100644 --- a/internal/httpclient/model_perform_native_logout_body.go +++ b/internal/httpclient/model_perform_native_logout_body.go @@ -1,26 +1,33 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the PerformNativeLogoutBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PerformNativeLogoutBody{} + // PerformNativeLogoutBody Perform Native Logout Request Body type PerformNativeLogoutBody struct { // The Session Token Invalidate this session token. SessionToken string `json:"session_token"` } +type _PerformNativeLogoutBody PerformNativeLogoutBody + // NewPerformNativeLogoutBody instantiates a new PerformNativeLogoutBody object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -64,13 +71,56 @@ func (o *PerformNativeLogoutBody) SetSessionToken(v string) { } func (o PerformNativeLogoutBody) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["session_token"] = o.SessionToken + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } return json.Marshal(toSerialize) } +func (o PerformNativeLogoutBody) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["session_token"] = o.SessionToken + return toSerialize, nil +} + +func (o *PerformNativeLogoutBody) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "session_token", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varPerformNativeLogoutBody := _PerformNativeLogoutBody{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varPerformNativeLogoutBody) + + if err != nil { + return err + } + + *o = PerformNativeLogoutBody(varPerformNativeLogoutBody) + + return err +} + type NullablePerformNativeLogoutBody struct { value *PerformNativeLogoutBody isSet bool diff --git a/internal/httpclient/model_recovery_code_for_identity.go b/internal/httpclient/model_recovery_code_for_identity.go index a5027e7c882e..79a5ec375ec0 100644 --- a/internal/httpclient/model_recovery_code_for_identity.go +++ b/internal/httpclient/model_recovery_code_for_identity.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the RecoveryCodeForIdentity type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RecoveryCodeForIdentity{} + // RecoveryCodeForIdentity Used when an administrator creates a recovery code for an identity. type RecoveryCodeForIdentity struct { // Expires At is the timestamp of when the recovery flow expires The timestamp when the recovery code expires. @@ -26,6 +31,8 @@ type RecoveryCodeForIdentity struct { RecoveryLink string `json:"recovery_link"` } +type _RecoveryCodeForIdentity RecoveryCodeForIdentity + // NewRecoveryCodeForIdentity instantiates a new RecoveryCodeForIdentity object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -47,7 +54,7 @@ func NewRecoveryCodeForIdentityWithDefaults() *RecoveryCodeForIdentity { // GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. func (o *RecoveryCodeForIdentity) GetExpiresAt() time.Time { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { var ret time.Time return ret } @@ -57,7 +64,7 @@ func (o *RecoveryCodeForIdentity) GetExpiresAt() time.Time { // GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryCodeForIdentity) GetExpiresAtOk() (*time.Time, bool) { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { return nil, false } return o.ExpiresAt, true @@ -65,7 +72,7 @@ func (o *RecoveryCodeForIdentity) GetExpiresAtOk() (*time.Time, bool) { // HasExpiresAt returns a boolean if a field has been set. func (o *RecoveryCodeForIdentity) HasExpiresAt() bool { - if o != nil && o.ExpiresAt != nil { + if o != nil && !IsNil(o.ExpiresAt) { return true } @@ -126,17 +133,59 @@ func (o *RecoveryCodeForIdentity) SetRecoveryLink(v string) { } func (o RecoveryCodeForIdentity) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RecoveryCodeForIdentity) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.ExpiresAt != nil { + if !IsNil(o.ExpiresAt) { toSerialize["expires_at"] = o.ExpiresAt } - if true { - toSerialize["recovery_code"] = o.RecoveryCode + toSerialize["recovery_code"] = o.RecoveryCode + toSerialize["recovery_link"] = o.RecoveryLink + return toSerialize, nil +} + +func (o *RecoveryCodeForIdentity) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "recovery_code", + "recovery_link", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["recovery_link"] = o.RecoveryLink + + varRecoveryCodeForIdentity := _RecoveryCodeForIdentity{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRecoveryCodeForIdentity) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = RecoveryCodeForIdentity(varRecoveryCodeForIdentity) + + return err } type NullableRecoveryCodeForIdentity struct { diff --git a/internal/httpclient/model_recovery_flow.go b/internal/httpclient/model_recovery_flow.go index e6df63a7c6b2..b24a6a610eaf 100644 --- a/internal/httpclient/model_recovery_flow.go +++ b/internal/httpclient/model_recovery_flow.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the RecoveryFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RecoveryFlow{} + // RecoveryFlow This request is used when an identity wants to recover their account. We recommend reading the [Account Recovery Documentation](../self-service/flows/password-reset-account-recovery) type RecoveryFlow struct { // Active, if set, contains the recovery method that is being used. It is initially not set. @@ -39,6 +44,8 @@ type RecoveryFlow struct { Ui UiContainer `json:"ui"` } +type _RecoveryFlow RecoveryFlow + // NewRecoveryFlow instantiates a new RecoveryFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -65,7 +72,7 @@ func NewRecoveryFlowWithDefaults() *RecoveryFlow { // GetActive returns the Active field value if set, zero value otherwise. func (o *RecoveryFlow) GetActive() string { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { var ret string return ret } @@ -75,7 +82,7 @@ func (o *RecoveryFlow) GetActive() string { // GetActiveOk returns a tuple with the Active field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryFlow) GetActiveOk() (*string, bool) { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { return nil, false } return o.Active, true @@ -83,7 +90,7 @@ func (o *RecoveryFlow) GetActiveOk() (*string, bool) { // HasActive returns a boolean if a field has been set. func (o *RecoveryFlow) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } @@ -97,7 +104,7 @@ func (o *RecoveryFlow) SetActive(v string) { // GetContinueWith returns the ContinueWith field value if set, zero value otherwise. func (o *RecoveryFlow) GetContinueWith() []ContinueWith { - if o == nil || o.ContinueWith == nil { + if o == nil || IsNil(o.ContinueWith) { var ret []ContinueWith return ret } @@ -107,7 +114,7 @@ func (o *RecoveryFlow) GetContinueWith() []ContinueWith { // GetContinueWithOk returns a tuple with the ContinueWith field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryFlow) GetContinueWithOk() ([]ContinueWith, bool) { - if o == nil || o.ContinueWith == nil { + if o == nil || IsNil(o.ContinueWith) { return nil, false } return o.ContinueWith, true @@ -115,7 +122,7 @@ func (o *RecoveryFlow) GetContinueWithOk() ([]ContinueWith, bool) { // HasContinueWith returns a boolean if a field has been set. func (o *RecoveryFlow) HasContinueWith() bool { - if o != nil && o.ContinueWith != nil { + if o != nil && !IsNil(o.ContinueWith) { return true } @@ -225,7 +232,7 @@ func (o *RecoveryFlow) SetRequestUrl(v string) { // GetReturnTo returns the ReturnTo field value if set, zero value otherwise. func (o *RecoveryFlow) GetReturnTo() string { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { var ret string return ret } @@ -235,7 +242,7 @@ func (o *RecoveryFlow) GetReturnTo() string { // GetReturnToOk returns a tuple with the ReturnTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryFlow) GetReturnToOk() (*string, bool) { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { return nil, false } return o.ReturnTo, true @@ -243,7 +250,7 @@ func (o *RecoveryFlow) GetReturnToOk() (*string, bool) { // HasReturnTo returns a boolean if a field has been set. func (o *RecoveryFlow) HasReturnTo() bool { - if o != nil && o.ReturnTo != nil { + if o != nil && !IsNil(o.ReturnTo) { return true } @@ -270,7 +277,7 @@ func (o *RecoveryFlow) GetState() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *RecoveryFlow) GetStateOk() (*interface{}, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return &o.State, true @@ -330,38 +337,77 @@ func (o *RecoveryFlow) SetUi(v UiContainer) { } func (o RecoveryFlow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RecoveryFlow) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - if o.ContinueWith != nil { + if !IsNil(o.ContinueWith) { toSerialize["continue_with"] = o.ContinueWith } - if true { - toSerialize["expires_at"] = o.ExpiresAt - } - if true { - toSerialize["id"] = o.Id - } - if true { - toSerialize["issued_at"] = o.IssuedAt - } - if true { - toSerialize["request_url"] = o.RequestUrl - } - if o.ReturnTo != nil { + toSerialize["expires_at"] = o.ExpiresAt + toSerialize["id"] = o.Id + toSerialize["issued_at"] = o.IssuedAt + toSerialize["request_url"] = o.RequestUrl + if !IsNil(o.ReturnTo) { toSerialize["return_to"] = o.ReturnTo } if o.State != nil { toSerialize["state"] = o.State } - if true { - toSerialize["type"] = o.Type + toSerialize["type"] = o.Type + toSerialize["ui"] = o.Ui + return toSerialize, nil +} + +func (o *RecoveryFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "expires_at", + "id", + "issued_at", + "request_url", + "state", + "type", + "ui", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["ui"] = o.Ui + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varRecoveryFlow := _RecoveryFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRecoveryFlow) + + if err != nil { + return err + } + + *o = RecoveryFlow(varRecoveryFlow) + + return err } type NullableRecoveryFlow struct { diff --git a/internal/httpclient/model_recovery_flow_state.go b/internal/httpclient/model_recovery_flow_state.go index 1c660ba043b9..12bac3edb7f9 100644 --- a/internal/httpclient/model_recovery_flow_state.go +++ b/internal/httpclient/model_recovery_flow_state.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -26,6 +26,13 @@ const ( RECOVERYFLOWSTATE_PASSED_CHALLENGE RecoveryFlowState = "passed_challenge" ) +// All allowed values of RecoveryFlowState enum +var AllowedRecoveryFlowStateEnumValues = []RecoveryFlowState{ + "choose_method", + "sent_email", + "passed_challenge", +} + func (v *RecoveryFlowState) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -33,7 +40,7 @@ func (v *RecoveryFlowState) UnmarshalJSON(src []byte) error { return err } enumTypeValue := RecoveryFlowState(value) - for _, existing := range []RecoveryFlowState{"choose_method", "sent_email", "passed_challenge"} { + for _, existing := range AllowedRecoveryFlowStateEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -43,6 +50,27 @@ func (v *RecoveryFlowState) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid RecoveryFlowState", value) } +// NewRecoveryFlowStateFromValue returns a pointer to a valid RecoveryFlowState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRecoveryFlowStateFromValue(v string) (*RecoveryFlowState, error) { + ev := RecoveryFlowState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for RecoveryFlowState: valid values are %v", v, AllowedRecoveryFlowStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v RecoveryFlowState) IsValid() bool { + for _, existing := range AllowedRecoveryFlowStateEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to recoveryFlowState value func (v RecoveryFlowState) Ptr() *RecoveryFlowState { return &v diff --git a/internal/httpclient/model_recovery_identity_address.go b/internal/httpclient/model_recovery_identity_address.go index 8247f3533794..3750b6a62491 100644 --- a/internal/httpclient/model_recovery_identity_address.go +++ b/internal/httpclient/model_recovery_identity_address.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the RecoveryIdentityAddress type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RecoveryIdentityAddress{} + // RecoveryIdentityAddress struct for RecoveryIdentityAddress type RecoveryIdentityAddress struct { // CreatedAt is a helper struct field for gobuffalo.pop. @@ -27,6 +32,8 @@ type RecoveryIdentityAddress struct { Via string `json:"via"` } +type _RecoveryIdentityAddress RecoveryIdentityAddress + // NewRecoveryIdentityAddress instantiates a new RecoveryIdentityAddress object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -49,7 +56,7 @@ func NewRecoveryIdentityAddressWithDefaults() *RecoveryIdentityAddress { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *RecoveryIdentityAddress) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -59,7 +66,7 @@ func (o *RecoveryIdentityAddress) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryIdentityAddress) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -67,7 +74,7 @@ func (o *RecoveryIdentityAddress) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *RecoveryIdentityAddress) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -105,7 +112,7 @@ func (o *RecoveryIdentityAddress) SetId(v string) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *RecoveryIdentityAddress) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -115,7 +122,7 @@ func (o *RecoveryIdentityAddress) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryIdentityAddress) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -123,7 +130,7 @@ func (o *RecoveryIdentityAddress) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *RecoveryIdentityAddress) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -184,23 +191,64 @@ func (o *RecoveryIdentityAddress) SetVia(v string) { } func (o RecoveryIdentityAddress) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RecoveryIdentityAddress) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if true { - toSerialize["id"] = o.Id - } - if o.UpdatedAt != nil { + toSerialize["id"] = o.Id + if !IsNil(o.UpdatedAt) { toSerialize["updated_at"] = o.UpdatedAt } - if true { - toSerialize["value"] = o.Value + toSerialize["value"] = o.Value + toSerialize["via"] = o.Via + return toSerialize, nil +} + +func (o *RecoveryIdentityAddress) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "value", + "via", } - if true { - toSerialize["via"] = o.Via + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varRecoveryIdentityAddress := _RecoveryIdentityAddress{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRecoveryIdentityAddress) + + if err != nil { + return err + } + + *o = RecoveryIdentityAddress(varRecoveryIdentityAddress) + + return err } type NullableRecoveryIdentityAddress struct { diff --git a/internal/httpclient/model_recovery_link_for_identity.go b/internal/httpclient/model_recovery_link_for_identity.go index 2694706eabae..46693ffc49a7 100644 --- a/internal/httpclient/model_recovery_link_for_identity.go +++ b/internal/httpclient/model_recovery_link_for_identity.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the RecoveryLinkForIdentity type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RecoveryLinkForIdentity{} + // RecoveryLinkForIdentity Used when an administrator creates a recovery link for an identity. type RecoveryLinkForIdentity struct { // Recovery Link Expires At The timestamp when the recovery link expires. @@ -24,6 +29,8 @@ type RecoveryLinkForIdentity struct { RecoveryLink string `json:"recovery_link"` } +type _RecoveryLinkForIdentity RecoveryLinkForIdentity + // NewRecoveryLinkForIdentity instantiates a new RecoveryLinkForIdentity object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -44,7 +51,7 @@ func NewRecoveryLinkForIdentityWithDefaults() *RecoveryLinkForIdentity { // GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. func (o *RecoveryLinkForIdentity) GetExpiresAt() time.Time { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { var ret time.Time return ret } @@ -54,7 +61,7 @@ func (o *RecoveryLinkForIdentity) GetExpiresAt() time.Time { // GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RecoveryLinkForIdentity) GetExpiresAtOk() (*time.Time, bool) { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { return nil, false } return o.ExpiresAt, true @@ -62,7 +69,7 @@ func (o *RecoveryLinkForIdentity) GetExpiresAtOk() (*time.Time, bool) { // HasExpiresAt returns a boolean if a field has been set. func (o *RecoveryLinkForIdentity) HasExpiresAt() bool { - if o != nil && o.ExpiresAt != nil { + if o != nil && !IsNil(o.ExpiresAt) { return true } @@ -99,14 +106,57 @@ func (o *RecoveryLinkForIdentity) SetRecoveryLink(v string) { } func (o RecoveryLinkForIdentity) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RecoveryLinkForIdentity) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.ExpiresAt != nil { + if !IsNil(o.ExpiresAt) { toSerialize["expires_at"] = o.ExpiresAt } - if true { - toSerialize["recovery_link"] = o.RecoveryLink + toSerialize["recovery_link"] = o.RecoveryLink + return toSerialize, nil +} + +func (o *RecoveryLinkForIdentity) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "recovery_link", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varRecoveryLinkForIdentity := _RecoveryLinkForIdentity{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRecoveryLinkForIdentity) + + if err != nil { + return err + } + + *o = RecoveryLinkForIdentity(varRecoveryLinkForIdentity) + + return err } type NullableRecoveryLinkForIdentity struct { diff --git a/internal/httpclient/model_registration_flow.go b/internal/httpclient/model_registration_flow.go index 71ab2c03ebe2..acc8dc749b8c 100644 --- a/internal/httpclient/model_registration_flow.go +++ b/internal/httpclient/model_registration_flow.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the RegistrationFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RegistrationFlow{} + // RegistrationFlow struct for RegistrationFlow type RegistrationFlow struct { // Active, if set, contains the registration method that is being used. It is initially not set. password CredentialsTypePassword oidc CredentialsTypeOIDC totp CredentialsTypeTOTP lookup_secret CredentialsTypeLookup webauthn CredentialsTypeWebAuthn code CredentialsTypeCodeAuth link_recovery CredentialsTypeRecoveryLink CredentialsTypeRecoveryLink is a special credential type linked to the link strategy (recovery flow). It is not used within the credentials object itself. code_recovery CredentialsTypeRecoveryCode @@ -45,6 +50,8 @@ type RegistrationFlow struct { Ui UiContainer `json:"ui"` } +type _RegistrationFlow RegistrationFlow + // NewRegistrationFlow instantiates a new RegistrationFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -71,7 +78,7 @@ func NewRegistrationFlowWithDefaults() *RegistrationFlow { // GetActive returns the Active field value if set, zero value otherwise. func (o *RegistrationFlow) GetActive() string { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { var ret string return ret } @@ -81,7 +88,7 @@ func (o *RegistrationFlow) GetActive() string { // GetActiveOk returns a tuple with the Active field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RegistrationFlow) GetActiveOk() (*string, bool) { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { return nil, false } return o.Active, true @@ -89,7 +96,7 @@ func (o *RegistrationFlow) GetActiveOk() (*string, bool) { // HasActive returns a boolean if a field has been set. func (o *RegistrationFlow) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } @@ -175,7 +182,7 @@ func (o *RegistrationFlow) SetIssuedAt(v time.Time) { // GetOauth2LoginChallenge returns the Oauth2LoginChallenge field value if set, zero value otherwise. func (o *RegistrationFlow) GetOauth2LoginChallenge() string { - if o == nil || o.Oauth2LoginChallenge == nil { + if o == nil || IsNil(o.Oauth2LoginChallenge) { var ret string return ret } @@ -185,7 +192,7 @@ func (o *RegistrationFlow) GetOauth2LoginChallenge() string { // GetOauth2LoginChallengeOk returns a tuple with the Oauth2LoginChallenge field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RegistrationFlow) GetOauth2LoginChallengeOk() (*string, bool) { - if o == nil || o.Oauth2LoginChallenge == nil { + if o == nil || IsNil(o.Oauth2LoginChallenge) { return nil, false } return o.Oauth2LoginChallenge, true @@ -193,7 +200,7 @@ func (o *RegistrationFlow) GetOauth2LoginChallengeOk() (*string, bool) { // HasOauth2LoginChallenge returns a boolean if a field has been set. func (o *RegistrationFlow) HasOauth2LoginChallenge() bool { - if o != nil && o.Oauth2LoginChallenge != nil { + if o != nil && !IsNil(o.Oauth2LoginChallenge) { return true } @@ -207,7 +214,7 @@ func (o *RegistrationFlow) SetOauth2LoginChallenge(v string) { // GetOauth2LoginRequest returns the Oauth2LoginRequest field value if set, zero value otherwise. func (o *RegistrationFlow) GetOauth2LoginRequest() OAuth2LoginRequest { - if o == nil || o.Oauth2LoginRequest == nil { + if o == nil || IsNil(o.Oauth2LoginRequest) { var ret OAuth2LoginRequest return ret } @@ -217,7 +224,7 @@ func (o *RegistrationFlow) GetOauth2LoginRequest() OAuth2LoginRequest { // GetOauth2LoginRequestOk returns a tuple with the Oauth2LoginRequest field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RegistrationFlow) GetOauth2LoginRequestOk() (*OAuth2LoginRequest, bool) { - if o == nil || o.Oauth2LoginRequest == nil { + if o == nil || IsNil(o.Oauth2LoginRequest) { return nil, false } return o.Oauth2LoginRequest, true @@ -225,7 +232,7 @@ func (o *RegistrationFlow) GetOauth2LoginRequestOk() (*OAuth2LoginRequest, bool) // HasOauth2LoginRequest returns a boolean if a field has been set. func (o *RegistrationFlow) HasOauth2LoginRequest() bool { - if o != nil && o.Oauth2LoginRequest != nil { + if o != nil && !IsNil(o.Oauth2LoginRequest) { return true } @@ -239,7 +246,7 @@ func (o *RegistrationFlow) SetOauth2LoginRequest(v OAuth2LoginRequest) { // GetOrganizationId returns the OrganizationId field value if set, zero value otherwise (both if not set or set to explicit null). func (o *RegistrationFlow) GetOrganizationId() string { - if o == nil || o.OrganizationId.Get() == nil { + if o == nil || IsNil(o.OrganizationId.Get()) { var ret string return ret } @@ -306,7 +313,7 @@ func (o *RegistrationFlow) SetRequestUrl(v string) { // GetReturnTo returns the ReturnTo field value if set, zero value otherwise. func (o *RegistrationFlow) GetReturnTo() string { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { var ret string return ret } @@ -316,7 +323,7 @@ func (o *RegistrationFlow) GetReturnTo() string { // GetReturnToOk returns a tuple with the ReturnTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RegistrationFlow) GetReturnToOk() (*string, bool) { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { return nil, false } return o.ReturnTo, true @@ -324,7 +331,7 @@ func (o *RegistrationFlow) GetReturnToOk() (*string, bool) { // HasReturnTo returns a boolean if a field has been set. func (o *RegistrationFlow) HasReturnTo() bool { - if o != nil && o.ReturnTo != nil { + if o != nil && !IsNil(o.ReturnTo) { return true } @@ -338,7 +345,7 @@ func (o *RegistrationFlow) SetReturnTo(v string) { // GetSessionTokenExchangeCode returns the SessionTokenExchangeCode field value if set, zero value otherwise. func (o *RegistrationFlow) GetSessionTokenExchangeCode() string { - if o == nil || o.SessionTokenExchangeCode == nil { + if o == nil || IsNil(o.SessionTokenExchangeCode) { var ret string return ret } @@ -348,7 +355,7 @@ func (o *RegistrationFlow) GetSessionTokenExchangeCode() string { // GetSessionTokenExchangeCodeOk returns a tuple with the SessionTokenExchangeCode field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RegistrationFlow) GetSessionTokenExchangeCodeOk() (*string, bool) { - if o == nil || o.SessionTokenExchangeCode == nil { + if o == nil || IsNil(o.SessionTokenExchangeCode) { return nil, false } return o.SessionTokenExchangeCode, true @@ -356,7 +363,7 @@ func (o *RegistrationFlow) GetSessionTokenExchangeCodeOk() (*string, bool) { // HasSessionTokenExchangeCode returns a boolean if a field has been set. func (o *RegistrationFlow) HasSessionTokenExchangeCode() bool { - if o != nil && o.SessionTokenExchangeCode != nil { + if o != nil && !IsNil(o.SessionTokenExchangeCode) { return true } @@ -383,7 +390,7 @@ func (o *RegistrationFlow) GetState() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *RegistrationFlow) GetStateOk() (*interface{}, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return &o.State, true @@ -396,7 +403,7 @@ func (o *RegistrationFlow) SetState(v interface{}) { // GetTransientPayload returns the TransientPayload field value if set, zero value otherwise. func (o *RegistrationFlow) GetTransientPayload() map[string]interface{} { - if o == nil || o.TransientPayload == nil { + if o == nil || IsNil(o.TransientPayload) { var ret map[string]interface{} return ret } @@ -406,15 +413,15 @@ func (o *RegistrationFlow) GetTransientPayload() map[string]interface{} { // GetTransientPayloadOk returns a tuple with the TransientPayload field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RegistrationFlow) GetTransientPayloadOk() (map[string]interface{}, bool) { - if o == nil || o.TransientPayload == nil { - return nil, false + if o == nil || IsNil(o.TransientPayload) { + return map[string]interface{}{}, false } return o.TransientPayload, true } // HasTransientPayload returns a boolean if a field has been set. func (o *RegistrationFlow) HasTransientPayload() bool { - if o != nil && o.TransientPayload != nil { + if o != nil && !IsNil(o.TransientPayload) { return true } @@ -475,50 +482,89 @@ func (o *RegistrationFlow) SetUi(v UiContainer) { } func (o RegistrationFlow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RegistrationFlow) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - if true { - toSerialize["expires_at"] = o.ExpiresAt - } - if true { - toSerialize["id"] = o.Id - } - if true { - toSerialize["issued_at"] = o.IssuedAt - } - if o.Oauth2LoginChallenge != nil { + toSerialize["expires_at"] = o.ExpiresAt + toSerialize["id"] = o.Id + toSerialize["issued_at"] = o.IssuedAt + if !IsNil(o.Oauth2LoginChallenge) { toSerialize["oauth2_login_challenge"] = o.Oauth2LoginChallenge } - if o.Oauth2LoginRequest != nil { + if !IsNil(o.Oauth2LoginRequest) { toSerialize["oauth2_login_request"] = o.Oauth2LoginRequest } if o.OrganizationId.IsSet() { toSerialize["organization_id"] = o.OrganizationId.Get() } - if true { - toSerialize["request_url"] = o.RequestUrl - } - if o.ReturnTo != nil { + toSerialize["request_url"] = o.RequestUrl + if !IsNil(o.ReturnTo) { toSerialize["return_to"] = o.ReturnTo } - if o.SessionTokenExchangeCode != nil { + if !IsNil(o.SessionTokenExchangeCode) { toSerialize["session_token_exchange_code"] = o.SessionTokenExchangeCode } if o.State != nil { toSerialize["state"] = o.State } - if o.TransientPayload != nil { + if !IsNil(o.TransientPayload) { toSerialize["transient_payload"] = o.TransientPayload } - if true { - toSerialize["type"] = o.Type + toSerialize["type"] = o.Type + toSerialize["ui"] = o.Ui + return toSerialize, nil +} + +func (o *RegistrationFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "expires_at", + "id", + "issued_at", + "request_url", + "state", + "type", + "ui", } - if true { - toSerialize["ui"] = o.Ui + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varRegistrationFlow := _RegistrationFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRegistrationFlow) + + if err != nil { + return err + } + + *o = RegistrationFlow(varRegistrationFlow) + + return err } type NullableRegistrationFlow struct { diff --git a/internal/httpclient/model_registration_flow_state.go b/internal/httpclient/model_registration_flow_state.go index 86f3fd38cff0..23bf897aace5 100644 --- a/internal/httpclient/model_registration_flow_state.go +++ b/internal/httpclient/model_registration_flow_state.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -26,6 +26,13 @@ const ( REGISTRATIONFLOWSTATE_PASSED_CHALLENGE RegistrationFlowState = "passed_challenge" ) +// All allowed values of RegistrationFlowState enum +var AllowedRegistrationFlowStateEnumValues = []RegistrationFlowState{ + "choose_method", + "sent_email", + "passed_challenge", +} + func (v *RegistrationFlowState) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -33,7 +40,7 @@ func (v *RegistrationFlowState) UnmarshalJSON(src []byte) error { return err } enumTypeValue := RegistrationFlowState(value) - for _, existing := range []RegistrationFlowState{"choose_method", "sent_email", "passed_challenge"} { + for _, existing := range AllowedRegistrationFlowStateEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -43,6 +50,27 @@ func (v *RegistrationFlowState) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid RegistrationFlowState", value) } +// NewRegistrationFlowStateFromValue returns a pointer to a valid RegistrationFlowState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRegistrationFlowStateFromValue(v string) (*RegistrationFlowState, error) { + ev := RegistrationFlowState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for RegistrationFlowState: valid values are %v", v, AllowedRegistrationFlowStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v RegistrationFlowState) IsValid() bool { + for _, existing := range AllowedRegistrationFlowStateEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to registrationFlowState value func (v RegistrationFlowState) Ptr() *RegistrationFlowState { return &v diff --git a/internal/httpclient/model_self_service_flow_expired_error.go b/internal/httpclient/model_self_service_flow_expired_error.go index a84737381a2d..c369e75d78a1 100644 --- a/internal/httpclient/model_self_service_flow_expired_error.go +++ b/internal/httpclient/model_self_service_flow_expired_error.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -16,6 +16,9 @@ import ( "time" ) +// checks if the SelfServiceFlowExpiredError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SelfServiceFlowExpiredError{} + // SelfServiceFlowExpiredError Is sent when a flow is expired type SelfServiceFlowExpiredError struct { Error *GenericError `json:"error,omitempty"` @@ -46,7 +49,7 @@ func NewSelfServiceFlowExpiredErrorWithDefaults() *SelfServiceFlowExpiredError { // GetError returns the Error field value if set, zero value otherwise. func (o *SelfServiceFlowExpiredError) GetError() GenericError { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { var ret GenericError return ret } @@ -56,7 +59,7 @@ func (o *SelfServiceFlowExpiredError) GetError() GenericError { // GetErrorOk returns a tuple with the Error field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SelfServiceFlowExpiredError) GetErrorOk() (*GenericError, bool) { - if o == nil || o.Error == nil { + if o == nil || IsNil(o.Error) { return nil, false } return o.Error, true @@ -64,7 +67,7 @@ func (o *SelfServiceFlowExpiredError) GetErrorOk() (*GenericError, bool) { // HasError returns a boolean if a field has been set. func (o *SelfServiceFlowExpiredError) HasError() bool { - if o != nil && o.Error != nil { + if o != nil && !IsNil(o.Error) { return true } @@ -78,7 +81,7 @@ func (o *SelfServiceFlowExpiredError) SetError(v GenericError) { // GetExpiredAt returns the ExpiredAt field value if set, zero value otherwise. func (o *SelfServiceFlowExpiredError) GetExpiredAt() time.Time { - if o == nil || o.ExpiredAt == nil { + if o == nil || IsNil(o.ExpiredAt) { var ret time.Time return ret } @@ -88,7 +91,7 @@ func (o *SelfServiceFlowExpiredError) GetExpiredAt() time.Time { // GetExpiredAtOk returns a tuple with the ExpiredAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SelfServiceFlowExpiredError) GetExpiredAtOk() (*time.Time, bool) { - if o == nil || o.ExpiredAt == nil { + if o == nil || IsNil(o.ExpiredAt) { return nil, false } return o.ExpiredAt, true @@ -96,7 +99,7 @@ func (o *SelfServiceFlowExpiredError) GetExpiredAtOk() (*time.Time, bool) { // HasExpiredAt returns a boolean if a field has been set. func (o *SelfServiceFlowExpiredError) HasExpiredAt() bool { - if o != nil && o.ExpiredAt != nil { + if o != nil && !IsNil(o.ExpiredAt) { return true } @@ -110,7 +113,7 @@ func (o *SelfServiceFlowExpiredError) SetExpiredAt(v time.Time) { // GetSince returns the Since field value if set, zero value otherwise. func (o *SelfServiceFlowExpiredError) GetSince() int64 { - if o == nil || o.Since == nil { + if o == nil || IsNil(o.Since) { var ret int64 return ret } @@ -120,7 +123,7 @@ func (o *SelfServiceFlowExpiredError) GetSince() int64 { // GetSinceOk returns a tuple with the Since field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SelfServiceFlowExpiredError) GetSinceOk() (*int64, bool) { - if o == nil || o.Since == nil { + if o == nil || IsNil(o.Since) { return nil, false } return o.Since, true @@ -128,7 +131,7 @@ func (o *SelfServiceFlowExpiredError) GetSinceOk() (*int64, bool) { // HasSince returns a boolean if a field has been set. func (o *SelfServiceFlowExpiredError) HasSince() bool { - if o != nil && o.Since != nil { + if o != nil && !IsNil(o.Since) { return true } @@ -142,7 +145,7 @@ func (o *SelfServiceFlowExpiredError) SetSince(v int64) { // GetUseFlowId returns the UseFlowId field value if set, zero value otherwise. func (o *SelfServiceFlowExpiredError) GetUseFlowId() string { - if o == nil || o.UseFlowId == nil { + if o == nil || IsNil(o.UseFlowId) { var ret string return ret } @@ -152,7 +155,7 @@ func (o *SelfServiceFlowExpiredError) GetUseFlowId() string { // GetUseFlowIdOk returns a tuple with the UseFlowId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SelfServiceFlowExpiredError) GetUseFlowIdOk() (*string, bool) { - if o == nil || o.UseFlowId == nil { + if o == nil || IsNil(o.UseFlowId) { return nil, false } return o.UseFlowId, true @@ -160,7 +163,7 @@ func (o *SelfServiceFlowExpiredError) GetUseFlowIdOk() (*string, bool) { // HasUseFlowId returns a boolean if a field has been set. func (o *SelfServiceFlowExpiredError) HasUseFlowId() bool { - if o != nil && o.UseFlowId != nil { + if o != nil && !IsNil(o.UseFlowId) { return true } @@ -173,20 +176,28 @@ func (o *SelfServiceFlowExpiredError) SetUseFlowId(v string) { } func (o SelfServiceFlowExpiredError) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SelfServiceFlowExpiredError) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Error != nil { + if !IsNil(o.Error) { toSerialize["error"] = o.Error } - if o.ExpiredAt != nil { + if !IsNil(o.ExpiredAt) { toSerialize["expired_at"] = o.ExpiredAt } - if o.Since != nil { + if !IsNil(o.Since) { toSerialize["since"] = o.Since } - if o.UseFlowId != nil { + if !IsNil(o.UseFlowId) { toSerialize["use_flow_id"] = o.UseFlowId } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableSelfServiceFlowExpiredError struct { diff --git a/internal/httpclient/model_session.go b/internal/httpclient/model_session.go index aa10a1dac55c..8e66537e374e 100644 --- a/internal/httpclient/model_session.go +++ b/internal/httpclient/model_session.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the Session type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Session{} + // Session A Session type Session struct { // Active state. If false the session is no longer active. @@ -38,6 +43,8 @@ type Session struct { Tokenized *string `json:"tokenized,omitempty"` } +type _Session Session + // NewSession instantiates a new Session object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -58,7 +65,7 @@ func NewSessionWithDefaults() *Session { // GetActive returns the Active field value if set, zero value otherwise. func (o *Session) GetActive() bool { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { var ret bool return ret } @@ -68,7 +75,7 @@ func (o *Session) GetActive() bool { // GetActiveOk returns a tuple with the Active field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetActiveOk() (*bool, bool) { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { return nil, false } return o.Active, true @@ -76,7 +83,7 @@ func (o *Session) GetActiveOk() (*bool, bool) { // HasActive returns a boolean if a field has been set. func (o *Session) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } @@ -90,7 +97,7 @@ func (o *Session) SetActive(v bool) { // GetAuthenticatedAt returns the AuthenticatedAt field value if set, zero value otherwise. func (o *Session) GetAuthenticatedAt() time.Time { - if o == nil || o.AuthenticatedAt == nil { + if o == nil || IsNil(o.AuthenticatedAt) { var ret time.Time return ret } @@ -100,7 +107,7 @@ func (o *Session) GetAuthenticatedAt() time.Time { // GetAuthenticatedAtOk returns a tuple with the AuthenticatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetAuthenticatedAtOk() (*time.Time, bool) { - if o == nil || o.AuthenticatedAt == nil { + if o == nil || IsNil(o.AuthenticatedAt) { return nil, false } return o.AuthenticatedAt, true @@ -108,7 +115,7 @@ func (o *Session) GetAuthenticatedAtOk() (*time.Time, bool) { // HasAuthenticatedAt returns a boolean if a field has been set. func (o *Session) HasAuthenticatedAt() bool { - if o != nil && o.AuthenticatedAt != nil { + if o != nil && !IsNil(o.AuthenticatedAt) { return true } @@ -122,7 +129,7 @@ func (o *Session) SetAuthenticatedAt(v time.Time) { // GetAuthenticationMethods returns the AuthenticationMethods field value if set, zero value otherwise. func (o *Session) GetAuthenticationMethods() []SessionAuthenticationMethod { - if o == nil || o.AuthenticationMethods == nil { + if o == nil || IsNil(o.AuthenticationMethods) { var ret []SessionAuthenticationMethod return ret } @@ -132,7 +139,7 @@ func (o *Session) GetAuthenticationMethods() []SessionAuthenticationMethod { // GetAuthenticationMethodsOk returns a tuple with the AuthenticationMethods field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetAuthenticationMethodsOk() ([]SessionAuthenticationMethod, bool) { - if o == nil || o.AuthenticationMethods == nil { + if o == nil || IsNil(o.AuthenticationMethods) { return nil, false } return o.AuthenticationMethods, true @@ -140,7 +147,7 @@ func (o *Session) GetAuthenticationMethodsOk() ([]SessionAuthenticationMethod, b // HasAuthenticationMethods returns a boolean if a field has been set. func (o *Session) HasAuthenticationMethods() bool { - if o != nil && o.AuthenticationMethods != nil { + if o != nil && !IsNil(o.AuthenticationMethods) { return true } @@ -154,7 +161,7 @@ func (o *Session) SetAuthenticationMethods(v []SessionAuthenticationMethod) { // GetAuthenticatorAssuranceLevel returns the AuthenticatorAssuranceLevel field value if set, zero value otherwise. func (o *Session) GetAuthenticatorAssuranceLevel() AuthenticatorAssuranceLevel { - if o == nil || o.AuthenticatorAssuranceLevel == nil { + if o == nil || IsNil(o.AuthenticatorAssuranceLevel) { var ret AuthenticatorAssuranceLevel return ret } @@ -164,7 +171,7 @@ func (o *Session) GetAuthenticatorAssuranceLevel() AuthenticatorAssuranceLevel { // GetAuthenticatorAssuranceLevelOk returns a tuple with the AuthenticatorAssuranceLevel field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetAuthenticatorAssuranceLevelOk() (*AuthenticatorAssuranceLevel, bool) { - if o == nil || o.AuthenticatorAssuranceLevel == nil { + if o == nil || IsNil(o.AuthenticatorAssuranceLevel) { return nil, false } return o.AuthenticatorAssuranceLevel, true @@ -172,7 +179,7 @@ func (o *Session) GetAuthenticatorAssuranceLevelOk() (*AuthenticatorAssuranceLev // HasAuthenticatorAssuranceLevel returns a boolean if a field has been set. func (o *Session) HasAuthenticatorAssuranceLevel() bool { - if o != nil && o.AuthenticatorAssuranceLevel != nil { + if o != nil && !IsNil(o.AuthenticatorAssuranceLevel) { return true } @@ -186,7 +193,7 @@ func (o *Session) SetAuthenticatorAssuranceLevel(v AuthenticatorAssuranceLevel) // GetDevices returns the Devices field value if set, zero value otherwise. func (o *Session) GetDevices() []SessionDevice { - if o == nil || o.Devices == nil { + if o == nil || IsNil(o.Devices) { var ret []SessionDevice return ret } @@ -196,7 +203,7 @@ func (o *Session) GetDevices() []SessionDevice { // GetDevicesOk returns a tuple with the Devices field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetDevicesOk() ([]SessionDevice, bool) { - if o == nil || o.Devices == nil { + if o == nil || IsNil(o.Devices) { return nil, false } return o.Devices, true @@ -204,7 +211,7 @@ func (o *Session) GetDevicesOk() ([]SessionDevice, bool) { // HasDevices returns a boolean if a field has been set. func (o *Session) HasDevices() bool { - if o != nil && o.Devices != nil { + if o != nil && !IsNil(o.Devices) { return true } @@ -218,7 +225,7 @@ func (o *Session) SetDevices(v []SessionDevice) { // GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. func (o *Session) GetExpiresAt() time.Time { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { var ret time.Time return ret } @@ -228,7 +235,7 @@ func (o *Session) GetExpiresAt() time.Time { // GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetExpiresAtOk() (*time.Time, bool) { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { return nil, false } return o.ExpiresAt, true @@ -236,7 +243,7 @@ func (o *Session) GetExpiresAtOk() (*time.Time, bool) { // HasExpiresAt returns a boolean if a field has been set. func (o *Session) HasExpiresAt() bool { - if o != nil && o.ExpiresAt != nil { + if o != nil && !IsNil(o.ExpiresAt) { return true } @@ -274,7 +281,7 @@ func (o *Session) SetId(v string) { // GetIdentity returns the Identity field value if set, zero value otherwise. func (o *Session) GetIdentity() Identity { - if o == nil || o.Identity == nil { + if o == nil || IsNil(o.Identity) { var ret Identity return ret } @@ -284,7 +291,7 @@ func (o *Session) GetIdentity() Identity { // GetIdentityOk returns a tuple with the Identity field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetIdentityOk() (*Identity, bool) { - if o == nil || o.Identity == nil { + if o == nil || IsNil(o.Identity) { return nil, false } return o.Identity, true @@ -292,7 +299,7 @@ func (o *Session) GetIdentityOk() (*Identity, bool) { // HasIdentity returns a boolean if a field has been set. func (o *Session) HasIdentity() bool { - if o != nil && o.Identity != nil { + if o != nil && !IsNil(o.Identity) { return true } @@ -306,7 +313,7 @@ func (o *Session) SetIdentity(v Identity) { // GetIssuedAt returns the IssuedAt field value if set, zero value otherwise. func (o *Session) GetIssuedAt() time.Time { - if o == nil || o.IssuedAt == nil { + if o == nil || IsNil(o.IssuedAt) { var ret time.Time return ret } @@ -316,7 +323,7 @@ func (o *Session) GetIssuedAt() time.Time { // GetIssuedAtOk returns a tuple with the IssuedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetIssuedAtOk() (*time.Time, bool) { - if o == nil || o.IssuedAt == nil { + if o == nil || IsNil(o.IssuedAt) { return nil, false } return o.IssuedAt, true @@ -324,7 +331,7 @@ func (o *Session) GetIssuedAtOk() (*time.Time, bool) { // HasIssuedAt returns a boolean if a field has been set. func (o *Session) HasIssuedAt() bool { - if o != nil && o.IssuedAt != nil { + if o != nil && !IsNil(o.IssuedAt) { return true } @@ -338,7 +345,7 @@ func (o *Session) SetIssuedAt(v time.Time) { // GetTokenized returns the Tokenized field value if set, zero value otherwise. func (o *Session) GetTokenized() string { - if o == nil || o.Tokenized == nil { + if o == nil || IsNil(o.Tokenized) { var ret string return ret } @@ -348,7 +355,7 @@ func (o *Session) GetTokenized() string { // GetTokenizedOk returns a tuple with the Tokenized field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Session) GetTokenizedOk() (*string, bool) { - if o == nil || o.Tokenized == nil { + if o == nil || IsNil(o.Tokenized) { return nil, false } return o.Tokenized, true @@ -356,7 +363,7 @@ func (o *Session) GetTokenizedOk() (*string, bool) { // HasTokenized returns a boolean if a field has been set. func (o *Session) HasTokenized() bool { - if o != nil && o.Tokenized != nil { + if o != nil && !IsNil(o.Tokenized) { return true } @@ -369,38 +376,81 @@ func (o *Session) SetTokenized(v string) { } func (o Session) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Session) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - if o.AuthenticatedAt != nil { + if !IsNil(o.AuthenticatedAt) { toSerialize["authenticated_at"] = o.AuthenticatedAt } - if o.AuthenticationMethods != nil { + if !IsNil(o.AuthenticationMethods) { toSerialize["authentication_methods"] = o.AuthenticationMethods } - if o.AuthenticatorAssuranceLevel != nil { + if !IsNil(o.AuthenticatorAssuranceLevel) { toSerialize["authenticator_assurance_level"] = o.AuthenticatorAssuranceLevel } - if o.Devices != nil { + if !IsNil(o.Devices) { toSerialize["devices"] = o.Devices } - if o.ExpiresAt != nil { + if !IsNil(o.ExpiresAt) { toSerialize["expires_at"] = o.ExpiresAt } - if true { - toSerialize["id"] = o.Id - } - if o.Identity != nil { + toSerialize["id"] = o.Id + if !IsNil(o.Identity) { toSerialize["identity"] = o.Identity } - if o.IssuedAt != nil { + if !IsNil(o.IssuedAt) { toSerialize["issued_at"] = o.IssuedAt } - if o.Tokenized != nil { + if !IsNil(o.Tokenized) { toSerialize["tokenized"] = o.Tokenized } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *Session) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSession := _Session{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSession) + + if err != nil { + return err + } + + *o = Session(varSession) + + return err } type NullableSession struct { diff --git a/internal/httpclient/model_session_authentication_method.go b/internal/httpclient/model_session_authentication_method.go index 17228de93141..4d5010f1acef 100644 --- a/internal/httpclient/model_session_authentication_method.go +++ b/internal/httpclient/model_session_authentication_method.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -16,6 +16,9 @@ import ( "time" ) +// checks if the SessionAuthenticationMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SessionAuthenticationMethod{} + // SessionAuthenticationMethod A singular authenticator used during authentication / login. type SessionAuthenticationMethod struct { Aal *AuthenticatorAssuranceLevel `json:"aal,omitempty"` @@ -47,7 +50,7 @@ func NewSessionAuthenticationMethodWithDefaults() *SessionAuthenticationMethod { // GetAal returns the Aal field value if set, zero value otherwise. func (o *SessionAuthenticationMethod) GetAal() AuthenticatorAssuranceLevel { - if o == nil || o.Aal == nil { + if o == nil || IsNil(o.Aal) { var ret AuthenticatorAssuranceLevel return ret } @@ -57,7 +60,7 @@ func (o *SessionAuthenticationMethod) GetAal() AuthenticatorAssuranceLevel { // GetAalOk returns a tuple with the Aal field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionAuthenticationMethod) GetAalOk() (*AuthenticatorAssuranceLevel, bool) { - if o == nil || o.Aal == nil { + if o == nil || IsNil(o.Aal) { return nil, false } return o.Aal, true @@ -65,7 +68,7 @@ func (o *SessionAuthenticationMethod) GetAalOk() (*AuthenticatorAssuranceLevel, // HasAal returns a boolean if a field has been set. func (o *SessionAuthenticationMethod) HasAal() bool { - if o != nil && o.Aal != nil { + if o != nil && !IsNil(o.Aal) { return true } @@ -79,7 +82,7 @@ func (o *SessionAuthenticationMethod) SetAal(v AuthenticatorAssuranceLevel) { // GetCompletedAt returns the CompletedAt field value if set, zero value otherwise. func (o *SessionAuthenticationMethod) GetCompletedAt() time.Time { - if o == nil || o.CompletedAt == nil { + if o == nil || IsNil(o.CompletedAt) { var ret time.Time return ret } @@ -89,7 +92,7 @@ func (o *SessionAuthenticationMethod) GetCompletedAt() time.Time { // GetCompletedAtOk returns a tuple with the CompletedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionAuthenticationMethod) GetCompletedAtOk() (*time.Time, bool) { - if o == nil || o.CompletedAt == nil { + if o == nil || IsNil(o.CompletedAt) { return nil, false } return o.CompletedAt, true @@ -97,7 +100,7 @@ func (o *SessionAuthenticationMethod) GetCompletedAtOk() (*time.Time, bool) { // HasCompletedAt returns a boolean if a field has been set. func (o *SessionAuthenticationMethod) HasCompletedAt() bool { - if o != nil && o.CompletedAt != nil { + if o != nil && !IsNil(o.CompletedAt) { return true } @@ -111,7 +114,7 @@ func (o *SessionAuthenticationMethod) SetCompletedAt(v time.Time) { // GetMethod returns the Method field value if set, zero value otherwise. func (o *SessionAuthenticationMethod) GetMethod() string { - if o == nil || o.Method == nil { + if o == nil || IsNil(o.Method) { var ret string return ret } @@ -121,7 +124,7 @@ func (o *SessionAuthenticationMethod) GetMethod() string { // GetMethodOk returns a tuple with the Method field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionAuthenticationMethod) GetMethodOk() (*string, bool) { - if o == nil || o.Method == nil { + if o == nil || IsNil(o.Method) { return nil, false } return o.Method, true @@ -129,7 +132,7 @@ func (o *SessionAuthenticationMethod) GetMethodOk() (*string, bool) { // HasMethod returns a boolean if a field has been set. func (o *SessionAuthenticationMethod) HasMethod() bool { - if o != nil && o.Method != nil { + if o != nil && !IsNil(o.Method) { return true } @@ -143,7 +146,7 @@ func (o *SessionAuthenticationMethod) SetMethod(v string) { // GetOrganization returns the Organization field value if set, zero value otherwise. func (o *SessionAuthenticationMethod) GetOrganization() string { - if o == nil || o.Organization == nil { + if o == nil || IsNil(o.Organization) { var ret string return ret } @@ -153,7 +156,7 @@ func (o *SessionAuthenticationMethod) GetOrganization() string { // GetOrganizationOk returns a tuple with the Organization field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionAuthenticationMethod) GetOrganizationOk() (*string, bool) { - if o == nil || o.Organization == nil { + if o == nil || IsNil(o.Organization) { return nil, false } return o.Organization, true @@ -161,7 +164,7 @@ func (o *SessionAuthenticationMethod) GetOrganizationOk() (*string, bool) { // HasOrganization returns a boolean if a field has been set. func (o *SessionAuthenticationMethod) HasOrganization() bool { - if o != nil && o.Organization != nil { + if o != nil && !IsNil(o.Organization) { return true } @@ -175,7 +178,7 @@ func (o *SessionAuthenticationMethod) SetOrganization(v string) { // GetProvider returns the Provider field value if set, zero value otherwise. func (o *SessionAuthenticationMethod) GetProvider() string { - if o == nil || o.Provider == nil { + if o == nil || IsNil(o.Provider) { var ret string return ret } @@ -185,7 +188,7 @@ func (o *SessionAuthenticationMethod) GetProvider() string { // GetProviderOk returns a tuple with the Provider field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionAuthenticationMethod) GetProviderOk() (*string, bool) { - if o == nil || o.Provider == nil { + if o == nil || IsNil(o.Provider) { return nil, false } return o.Provider, true @@ -193,7 +196,7 @@ func (o *SessionAuthenticationMethod) GetProviderOk() (*string, bool) { // HasProvider returns a boolean if a field has been set. func (o *SessionAuthenticationMethod) HasProvider() bool { - if o != nil && o.Provider != nil { + if o != nil && !IsNil(o.Provider) { return true } @@ -206,23 +209,31 @@ func (o *SessionAuthenticationMethod) SetProvider(v string) { } func (o SessionAuthenticationMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SessionAuthenticationMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Aal != nil { + if !IsNil(o.Aal) { toSerialize["aal"] = o.Aal } - if o.CompletedAt != nil { + if !IsNil(o.CompletedAt) { toSerialize["completed_at"] = o.CompletedAt } - if o.Method != nil { + if !IsNil(o.Method) { toSerialize["method"] = o.Method } - if o.Organization != nil { + if !IsNil(o.Organization) { toSerialize["organization"] = o.Organization } - if o.Provider != nil { + if !IsNil(o.Provider) { toSerialize["provider"] = o.Provider } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableSessionAuthenticationMethod struct { diff --git a/internal/httpclient/model_session_device.go b/internal/httpclient/model_session_device.go index 44e79c507dc1..2bb11ea18576 100644 --- a/internal/httpclient/model_session_device.go +++ b/internal/httpclient/model_session_device.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the SessionDevice type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SessionDevice{} + // SessionDevice Device corresponding to a Session type SessionDevice struct { // Device record ID @@ -27,6 +32,8 @@ type SessionDevice struct { UserAgent *string `json:"user_agent,omitempty"` } +type _SessionDevice SessionDevice + // NewSessionDevice instantiates a new SessionDevice object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -71,7 +78,7 @@ func (o *SessionDevice) SetId(v string) { // GetIpAddress returns the IpAddress field value if set, zero value otherwise. func (o *SessionDevice) GetIpAddress() string { - if o == nil || o.IpAddress == nil { + if o == nil || IsNil(o.IpAddress) { var ret string return ret } @@ -81,7 +88,7 @@ func (o *SessionDevice) GetIpAddress() string { // GetIpAddressOk returns a tuple with the IpAddress field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionDevice) GetIpAddressOk() (*string, bool) { - if o == nil || o.IpAddress == nil { + if o == nil || IsNil(o.IpAddress) { return nil, false } return o.IpAddress, true @@ -89,7 +96,7 @@ func (o *SessionDevice) GetIpAddressOk() (*string, bool) { // HasIpAddress returns a boolean if a field has been set. func (o *SessionDevice) HasIpAddress() bool { - if o != nil && o.IpAddress != nil { + if o != nil && !IsNil(o.IpAddress) { return true } @@ -103,7 +110,7 @@ func (o *SessionDevice) SetIpAddress(v string) { // GetLocation returns the Location field value if set, zero value otherwise. func (o *SessionDevice) GetLocation() string { - if o == nil || o.Location == nil { + if o == nil || IsNil(o.Location) { var ret string return ret } @@ -113,7 +120,7 @@ func (o *SessionDevice) GetLocation() string { // GetLocationOk returns a tuple with the Location field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionDevice) GetLocationOk() (*string, bool) { - if o == nil || o.Location == nil { + if o == nil || IsNil(o.Location) { return nil, false } return o.Location, true @@ -121,7 +128,7 @@ func (o *SessionDevice) GetLocationOk() (*string, bool) { // HasLocation returns a boolean if a field has been set. func (o *SessionDevice) HasLocation() bool { - if o != nil && o.Location != nil { + if o != nil && !IsNil(o.Location) { return true } @@ -135,7 +142,7 @@ func (o *SessionDevice) SetLocation(v string) { // GetUserAgent returns the UserAgent field value if set, zero value otherwise. func (o *SessionDevice) GetUserAgent() string { - if o == nil || o.UserAgent == nil { + if o == nil || IsNil(o.UserAgent) { var ret string return ret } @@ -145,7 +152,7 @@ func (o *SessionDevice) GetUserAgent() string { // GetUserAgentOk returns a tuple with the UserAgent field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SessionDevice) GetUserAgentOk() (*string, bool) { - if o == nil || o.UserAgent == nil { + if o == nil || IsNil(o.UserAgent) { return nil, false } return o.UserAgent, true @@ -153,7 +160,7 @@ func (o *SessionDevice) GetUserAgentOk() (*string, bool) { // HasUserAgent returns a boolean if a field has been set. func (o *SessionDevice) HasUserAgent() bool { - if o != nil && o.UserAgent != nil { + if o != nil && !IsNil(o.UserAgent) { return true } @@ -166,20 +173,63 @@ func (o *SessionDevice) SetUserAgent(v string) { } func (o SessionDevice) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["id"] = o.Id + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.IpAddress != nil { + return json.Marshal(toSerialize) +} + +func (o SessionDevice) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + if !IsNil(o.IpAddress) { toSerialize["ip_address"] = o.IpAddress } - if o.Location != nil { + if !IsNil(o.Location) { toSerialize["location"] = o.Location } - if o.UserAgent != nil { + if !IsNil(o.UserAgent) { toSerialize["user_agent"] = o.UserAgent } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *SessionDevice) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSessionDevice := _SessionDevice{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSessionDevice) + + if err != nil { + return err + } + + *o = SessionDevice(varSessionDevice) + + return err } type NullableSessionDevice struct { diff --git a/internal/httpclient/model_settings_flow.go b/internal/httpclient/model_settings_flow.go index fa5cd9317c54..4b07827c0d74 100644 --- a/internal/httpclient/model_settings_flow.go +++ b/internal/httpclient/model_settings_flow.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the SettingsFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SettingsFlow{} + // SettingsFlow This flow is used when an identity wants to update settings (e.g. profile data, passwords, ...) in a selfservice manner. We recommend reading the [User Settings Documentation](../self-service/flows/user-settings) type SettingsFlow struct { // Active, if set, contains the registration method that is being used. It is initially not set. @@ -40,6 +45,8 @@ type SettingsFlow struct { Ui UiContainer `json:"ui"` } +type _SettingsFlow SettingsFlow + // NewSettingsFlow instantiates a new SettingsFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -67,7 +74,7 @@ func NewSettingsFlowWithDefaults() *SettingsFlow { // GetActive returns the Active field value if set, zero value otherwise. func (o *SettingsFlow) GetActive() string { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { var ret string return ret } @@ -77,7 +84,7 @@ func (o *SettingsFlow) GetActive() string { // GetActiveOk returns a tuple with the Active field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SettingsFlow) GetActiveOk() (*string, bool) { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { return nil, false } return o.Active, true @@ -85,7 +92,7 @@ func (o *SettingsFlow) GetActiveOk() (*string, bool) { // HasActive returns a boolean if a field has been set. func (o *SettingsFlow) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } @@ -99,7 +106,7 @@ func (o *SettingsFlow) SetActive(v string) { // GetContinueWith returns the ContinueWith field value if set, zero value otherwise. func (o *SettingsFlow) GetContinueWith() []ContinueWith { - if o == nil || o.ContinueWith == nil { + if o == nil || IsNil(o.ContinueWith) { var ret []ContinueWith return ret } @@ -109,7 +116,7 @@ func (o *SettingsFlow) GetContinueWith() []ContinueWith { // GetContinueWithOk returns a tuple with the ContinueWith field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SettingsFlow) GetContinueWithOk() ([]ContinueWith, bool) { - if o == nil || o.ContinueWith == nil { + if o == nil || IsNil(o.ContinueWith) { return nil, false } return o.ContinueWith, true @@ -117,7 +124,7 @@ func (o *SettingsFlow) GetContinueWithOk() ([]ContinueWith, bool) { // HasContinueWith returns a boolean if a field has been set. func (o *SettingsFlow) HasContinueWith() bool { - if o != nil && o.ContinueWith != nil { + if o != nil && !IsNil(o.ContinueWith) { return true } @@ -251,7 +258,7 @@ func (o *SettingsFlow) SetRequestUrl(v string) { // GetReturnTo returns the ReturnTo field value if set, zero value otherwise. func (o *SettingsFlow) GetReturnTo() string { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { var ret string return ret } @@ -261,7 +268,7 @@ func (o *SettingsFlow) GetReturnTo() string { // GetReturnToOk returns a tuple with the ReturnTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SettingsFlow) GetReturnToOk() (*string, bool) { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { return nil, false } return o.ReturnTo, true @@ -269,7 +276,7 @@ func (o *SettingsFlow) GetReturnToOk() (*string, bool) { // HasReturnTo returns a boolean if a field has been set. func (o *SettingsFlow) HasReturnTo() bool { - if o != nil && o.ReturnTo != nil { + if o != nil && !IsNil(o.ReturnTo) { return true } @@ -296,7 +303,7 @@ func (o *SettingsFlow) GetState() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *SettingsFlow) GetStateOk() (*interface{}, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return &o.State, true @@ -356,41 +363,79 @@ func (o *SettingsFlow) SetUi(v UiContainer) { } func (o SettingsFlow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SettingsFlow) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - if o.ContinueWith != nil { + if !IsNil(o.ContinueWith) { toSerialize["continue_with"] = o.ContinueWith } - if true { - toSerialize["expires_at"] = o.ExpiresAt - } - if true { - toSerialize["id"] = o.Id - } - if true { - toSerialize["identity"] = o.Identity - } - if true { - toSerialize["issued_at"] = o.IssuedAt - } - if true { - toSerialize["request_url"] = o.RequestUrl - } - if o.ReturnTo != nil { + toSerialize["expires_at"] = o.ExpiresAt + toSerialize["id"] = o.Id + toSerialize["identity"] = o.Identity + toSerialize["issued_at"] = o.IssuedAt + toSerialize["request_url"] = o.RequestUrl + if !IsNil(o.ReturnTo) { toSerialize["return_to"] = o.ReturnTo } if o.State != nil { toSerialize["state"] = o.State } - if true { - toSerialize["type"] = o.Type + toSerialize["type"] = o.Type + toSerialize["ui"] = o.Ui + return toSerialize, nil +} + +func (o *SettingsFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "expires_at", + "id", + "identity", + "issued_at", + "request_url", + "state", + "type", + "ui", } - if true { - toSerialize["ui"] = o.Ui + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSettingsFlow := _SettingsFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSettingsFlow) + + if err != nil { + return err + } + + *o = SettingsFlow(varSettingsFlow) + + return err } type NullableSettingsFlow struct { diff --git a/internal/httpclient/model_settings_flow_state.go b/internal/httpclient/model_settings_flow_state.go index f994c786a2d8..d180c74d6884 100644 --- a/internal/httpclient/model_settings_flow_state.go +++ b/internal/httpclient/model_settings_flow_state.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -25,6 +25,12 @@ const ( SETTINGSFLOWSTATE_SUCCESS SettingsFlowState = "success" ) +// All allowed values of SettingsFlowState enum +var AllowedSettingsFlowStateEnumValues = []SettingsFlowState{ + "show_form", + "success", +} + func (v *SettingsFlowState) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -32,7 +38,7 @@ func (v *SettingsFlowState) UnmarshalJSON(src []byte) error { return err } enumTypeValue := SettingsFlowState(value) - for _, existing := range []SettingsFlowState{"show_form", "success"} { + for _, existing := range AllowedSettingsFlowStateEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -42,6 +48,27 @@ func (v *SettingsFlowState) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid SettingsFlowState", value) } +// NewSettingsFlowStateFromValue returns a pointer to a valid SettingsFlowState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSettingsFlowStateFromValue(v string) (*SettingsFlowState, error) { + ev := SettingsFlowState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SettingsFlowState: valid values are %v", v, AllowedSettingsFlowStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SettingsFlowState) IsValid() bool { + for _, existing := range AllowedSettingsFlowStateEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to settingsFlowState value func (v SettingsFlowState) Ptr() *SettingsFlowState { return &v diff --git a/internal/httpclient/model_successful_code_exchange_response.go b/internal/httpclient/model_successful_code_exchange_response.go index 9defabefefe5..a78f505d8fc1 100644 --- a/internal/httpclient/model_successful_code_exchange_response.go +++ b/internal/httpclient/model_successful_code_exchange_response.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the SuccessfulCodeExchangeResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SuccessfulCodeExchangeResponse{} + // SuccessfulCodeExchangeResponse The Response for Registration Flows via API type SuccessfulCodeExchangeResponse struct { Session Session `json:"session"` @@ -22,6 +27,8 @@ type SuccessfulCodeExchangeResponse struct { SessionToken *string `json:"session_token,omitempty"` } +type _SuccessfulCodeExchangeResponse SuccessfulCodeExchangeResponse + // NewSuccessfulCodeExchangeResponse instantiates a new SuccessfulCodeExchangeResponse object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -66,7 +73,7 @@ func (o *SuccessfulCodeExchangeResponse) SetSession(v Session) { // GetSessionToken returns the SessionToken field value if set, zero value otherwise. func (o *SuccessfulCodeExchangeResponse) GetSessionToken() string { - if o == nil || o.SessionToken == nil { + if o == nil || IsNil(o.SessionToken) { var ret string return ret } @@ -76,7 +83,7 @@ func (o *SuccessfulCodeExchangeResponse) GetSessionToken() string { // GetSessionTokenOk returns a tuple with the SessionToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SuccessfulCodeExchangeResponse) GetSessionTokenOk() (*string, bool) { - if o == nil || o.SessionToken == nil { + if o == nil || IsNil(o.SessionToken) { return nil, false } return o.SessionToken, true @@ -84,7 +91,7 @@ func (o *SuccessfulCodeExchangeResponse) GetSessionTokenOk() (*string, bool) { // HasSessionToken returns a boolean if a field has been set. func (o *SuccessfulCodeExchangeResponse) HasSessionToken() bool { - if o != nil && o.SessionToken != nil { + if o != nil && !IsNil(o.SessionToken) { return true } @@ -97,14 +104,57 @@ func (o *SuccessfulCodeExchangeResponse) SetSessionToken(v string) { } func (o SuccessfulCodeExchangeResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["session"] = o.Session + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.SessionToken != nil { + return json.Marshal(toSerialize) +} + +func (o SuccessfulCodeExchangeResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["session"] = o.Session + if !IsNil(o.SessionToken) { toSerialize["session_token"] = o.SessionToken } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *SuccessfulCodeExchangeResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "session", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSuccessfulCodeExchangeResponse := _SuccessfulCodeExchangeResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSuccessfulCodeExchangeResponse) + + if err != nil { + return err + } + + *o = SuccessfulCodeExchangeResponse(varSuccessfulCodeExchangeResponse) + + return err } type NullableSuccessfulCodeExchangeResponse struct { diff --git a/internal/httpclient/model_successful_native_login.go b/internal/httpclient/model_successful_native_login.go index f87739f19d12..d406a3870564 100644 --- a/internal/httpclient/model_successful_native_login.go +++ b/internal/httpclient/model_successful_native_login.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the SuccessfulNativeLogin type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SuccessfulNativeLogin{} + // SuccessfulNativeLogin The Response for Login Flows via API type SuccessfulNativeLogin struct { Session Session `json:"session"` @@ -22,6 +27,8 @@ type SuccessfulNativeLogin struct { SessionToken *string `json:"session_token,omitempty"` } +type _SuccessfulNativeLogin SuccessfulNativeLogin + // NewSuccessfulNativeLogin instantiates a new SuccessfulNativeLogin object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -66,7 +73,7 @@ func (o *SuccessfulNativeLogin) SetSession(v Session) { // GetSessionToken returns the SessionToken field value if set, zero value otherwise. func (o *SuccessfulNativeLogin) GetSessionToken() string { - if o == nil || o.SessionToken == nil { + if o == nil || IsNil(o.SessionToken) { var ret string return ret } @@ -76,7 +83,7 @@ func (o *SuccessfulNativeLogin) GetSessionToken() string { // GetSessionTokenOk returns a tuple with the SessionToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SuccessfulNativeLogin) GetSessionTokenOk() (*string, bool) { - if o == nil || o.SessionToken == nil { + if o == nil || IsNil(o.SessionToken) { return nil, false } return o.SessionToken, true @@ -84,7 +91,7 @@ func (o *SuccessfulNativeLogin) GetSessionTokenOk() (*string, bool) { // HasSessionToken returns a boolean if a field has been set. func (o *SuccessfulNativeLogin) HasSessionToken() bool { - if o != nil && o.SessionToken != nil { + if o != nil && !IsNil(o.SessionToken) { return true } @@ -97,14 +104,57 @@ func (o *SuccessfulNativeLogin) SetSessionToken(v string) { } func (o SuccessfulNativeLogin) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["session"] = o.Session + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.SessionToken != nil { + return json.Marshal(toSerialize) +} + +func (o SuccessfulNativeLogin) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["session"] = o.Session + if !IsNil(o.SessionToken) { toSerialize["session_token"] = o.SessionToken } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *SuccessfulNativeLogin) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "session", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSuccessfulNativeLogin := _SuccessfulNativeLogin{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSuccessfulNativeLogin) + + if err != nil { + return err + } + + *o = SuccessfulNativeLogin(varSuccessfulNativeLogin) + + return err } type NullableSuccessfulNativeLogin struct { diff --git a/internal/httpclient/model_successful_native_registration.go b/internal/httpclient/model_successful_native_registration.go index b56cc42bc6e5..98bbba63c0af 100644 --- a/internal/httpclient/model_successful_native_registration.go +++ b/internal/httpclient/model_successful_native_registration.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the SuccessfulNativeRegistration type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SuccessfulNativeRegistration{} + // SuccessfulNativeRegistration The Response for Registration Flows via API type SuccessfulNativeRegistration struct { // Contains a list of actions, that could follow this flow It can, for example, this will contain a reference to the verification flow, created as part of the user's registration or the token of the session. @@ -25,6 +30,8 @@ type SuccessfulNativeRegistration struct { SessionToken *string `json:"session_token,omitempty"` } +type _SuccessfulNativeRegistration SuccessfulNativeRegistration + // NewSuccessfulNativeRegistration instantiates a new SuccessfulNativeRegistration object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -45,7 +52,7 @@ func NewSuccessfulNativeRegistrationWithDefaults() *SuccessfulNativeRegistration // GetContinueWith returns the ContinueWith field value if set, zero value otherwise. func (o *SuccessfulNativeRegistration) GetContinueWith() []ContinueWith { - if o == nil || o.ContinueWith == nil { + if o == nil || IsNil(o.ContinueWith) { var ret []ContinueWith return ret } @@ -55,7 +62,7 @@ func (o *SuccessfulNativeRegistration) GetContinueWith() []ContinueWith { // GetContinueWithOk returns a tuple with the ContinueWith field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SuccessfulNativeRegistration) GetContinueWithOk() ([]ContinueWith, bool) { - if o == nil || o.ContinueWith == nil { + if o == nil || IsNil(o.ContinueWith) { return nil, false } return o.ContinueWith, true @@ -63,7 +70,7 @@ func (o *SuccessfulNativeRegistration) GetContinueWithOk() ([]ContinueWith, bool // HasContinueWith returns a boolean if a field has been set. func (o *SuccessfulNativeRegistration) HasContinueWith() bool { - if o != nil && o.ContinueWith != nil { + if o != nil && !IsNil(o.ContinueWith) { return true } @@ -101,7 +108,7 @@ func (o *SuccessfulNativeRegistration) SetIdentity(v Identity) { // GetSession returns the Session field value if set, zero value otherwise. func (o *SuccessfulNativeRegistration) GetSession() Session { - if o == nil || o.Session == nil { + if o == nil || IsNil(o.Session) { var ret Session return ret } @@ -111,7 +118,7 @@ func (o *SuccessfulNativeRegistration) GetSession() Session { // GetSessionOk returns a tuple with the Session field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SuccessfulNativeRegistration) GetSessionOk() (*Session, bool) { - if o == nil || o.Session == nil { + if o == nil || IsNil(o.Session) { return nil, false } return o.Session, true @@ -119,7 +126,7 @@ func (o *SuccessfulNativeRegistration) GetSessionOk() (*Session, bool) { // HasSession returns a boolean if a field has been set. func (o *SuccessfulNativeRegistration) HasSession() bool { - if o != nil && o.Session != nil { + if o != nil && !IsNil(o.Session) { return true } @@ -133,7 +140,7 @@ func (o *SuccessfulNativeRegistration) SetSession(v Session) { // GetSessionToken returns the SessionToken field value if set, zero value otherwise. func (o *SuccessfulNativeRegistration) GetSessionToken() string { - if o == nil || o.SessionToken == nil { + if o == nil || IsNil(o.SessionToken) { var ret string return ret } @@ -143,7 +150,7 @@ func (o *SuccessfulNativeRegistration) GetSessionToken() string { // GetSessionTokenOk returns a tuple with the SessionToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SuccessfulNativeRegistration) GetSessionTokenOk() (*string, bool) { - if o == nil || o.SessionToken == nil { + if o == nil || IsNil(o.SessionToken) { return nil, false } return o.SessionToken, true @@ -151,7 +158,7 @@ func (o *SuccessfulNativeRegistration) GetSessionTokenOk() (*string, bool) { // HasSessionToken returns a boolean if a field has been set. func (o *SuccessfulNativeRegistration) HasSessionToken() bool { - if o != nil && o.SessionToken != nil { + if o != nil && !IsNil(o.SessionToken) { return true } @@ -164,20 +171,63 @@ func (o *SuccessfulNativeRegistration) SetSessionToken(v string) { } func (o SuccessfulNativeRegistration) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SuccessfulNativeRegistration) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.ContinueWith != nil { + if !IsNil(o.ContinueWith) { toSerialize["continue_with"] = o.ContinueWith } - if true { - toSerialize["identity"] = o.Identity - } - if o.Session != nil { + toSerialize["identity"] = o.Identity + if !IsNil(o.Session) { toSerialize["session"] = o.Session } - if o.SessionToken != nil { + if !IsNil(o.SessionToken) { toSerialize["session_token"] = o.SessionToken } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *SuccessfulNativeRegistration) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "identity", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSuccessfulNativeRegistration := _SuccessfulNativeRegistration{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSuccessfulNativeRegistration) + + if err != nil { + return err + } + + *o = SuccessfulNativeRegistration(varSuccessfulNativeRegistration) + + return err } type NullableSuccessfulNativeRegistration struct { diff --git a/internal/httpclient/model_token_pagination.go b/internal/httpclient/model_token_pagination.go index b8422dd14242..84427921066a 100644 --- a/internal/httpclient/model_token_pagination.go +++ b/internal/httpclient/model_token_pagination.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the TokenPagination type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TokenPagination{} + // TokenPagination struct for TokenPagination type TokenPagination struct { // Items per page This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). @@ -50,7 +53,7 @@ func NewTokenPaginationWithDefaults() *TokenPagination { // GetPageSize returns the PageSize field value if set, zero value otherwise. func (o *TokenPagination) GetPageSize() int64 { - if o == nil || o.PageSize == nil { + if o == nil || IsNil(o.PageSize) { var ret int64 return ret } @@ -60,7 +63,7 @@ func (o *TokenPagination) GetPageSize() int64 { // GetPageSizeOk returns a tuple with the PageSize field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *TokenPagination) GetPageSizeOk() (*int64, bool) { - if o == nil || o.PageSize == nil { + if o == nil || IsNil(o.PageSize) { return nil, false } return o.PageSize, true @@ -68,7 +71,7 @@ func (o *TokenPagination) GetPageSizeOk() (*int64, bool) { // HasPageSize returns a boolean if a field has been set. func (o *TokenPagination) HasPageSize() bool { - if o != nil && o.PageSize != nil { + if o != nil && !IsNil(o.PageSize) { return true } @@ -82,7 +85,7 @@ func (o *TokenPagination) SetPageSize(v int64) { // GetPageToken returns the PageToken field value if set, zero value otherwise. func (o *TokenPagination) GetPageToken() string { - if o == nil || o.PageToken == nil { + if o == nil || IsNil(o.PageToken) { var ret string return ret } @@ -92,7 +95,7 @@ func (o *TokenPagination) GetPageToken() string { // GetPageTokenOk returns a tuple with the PageToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *TokenPagination) GetPageTokenOk() (*string, bool) { - if o == nil || o.PageToken == nil { + if o == nil || IsNil(o.PageToken) { return nil, false } return o.PageToken, true @@ -100,7 +103,7 @@ func (o *TokenPagination) GetPageTokenOk() (*string, bool) { // HasPageToken returns a boolean if a field has been set. func (o *TokenPagination) HasPageToken() bool { - if o != nil && o.PageToken != nil { + if o != nil && !IsNil(o.PageToken) { return true } @@ -113,14 +116,22 @@ func (o *TokenPagination) SetPageToken(v string) { } func (o TokenPagination) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TokenPagination) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.PageSize != nil { + if !IsNil(o.PageSize) { toSerialize["page_size"] = o.PageSize } - if o.PageToken != nil { + if !IsNil(o.PageToken) { toSerialize["page_token"] = o.PageToken } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableTokenPagination struct { diff --git a/internal/httpclient/model_token_pagination_headers.go b/internal/httpclient/model_token_pagination_headers.go index 00e0b840f124..592227e56b36 100644 --- a/internal/httpclient/model_token_pagination_headers.go +++ b/internal/httpclient/model_token_pagination_headers.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the TokenPaginationHeaders type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TokenPaginationHeaders{} + // TokenPaginationHeaders struct for TokenPaginationHeaders type TokenPaginationHeaders struct { // The link header contains pagination links. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination). in: header @@ -42,7 +45,7 @@ func NewTokenPaginationHeadersWithDefaults() *TokenPaginationHeaders { // GetLink returns the Link field value if set, zero value otherwise. func (o *TokenPaginationHeaders) GetLink() string { - if o == nil || o.Link == nil { + if o == nil || IsNil(o.Link) { var ret string return ret } @@ -52,7 +55,7 @@ func (o *TokenPaginationHeaders) GetLink() string { // GetLinkOk returns a tuple with the Link field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *TokenPaginationHeaders) GetLinkOk() (*string, bool) { - if o == nil || o.Link == nil { + if o == nil || IsNil(o.Link) { return nil, false } return o.Link, true @@ -60,7 +63,7 @@ func (o *TokenPaginationHeaders) GetLinkOk() (*string, bool) { // HasLink returns a boolean if a field has been set. func (o *TokenPaginationHeaders) HasLink() bool { - if o != nil && o.Link != nil { + if o != nil && !IsNil(o.Link) { return true } @@ -74,7 +77,7 @@ func (o *TokenPaginationHeaders) SetLink(v string) { // GetXTotalCount returns the XTotalCount field value if set, zero value otherwise. func (o *TokenPaginationHeaders) GetXTotalCount() string { - if o == nil || o.XTotalCount == nil { + if o == nil || IsNil(o.XTotalCount) { var ret string return ret } @@ -84,7 +87,7 @@ func (o *TokenPaginationHeaders) GetXTotalCount() string { // GetXTotalCountOk returns a tuple with the XTotalCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *TokenPaginationHeaders) GetXTotalCountOk() (*string, bool) { - if o == nil || o.XTotalCount == nil { + if o == nil || IsNil(o.XTotalCount) { return nil, false } return o.XTotalCount, true @@ -92,7 +95,7 @@ func (o *TokenPaginationHeaders) GetXTotalCountOk() (*string, bool) { // HasXTotalCount returns a boolean if a field has been set. func (o *TokenPaginationHeaders) HasXTotalCount() bool { - if o != nil && o.XTotalCount != nil { + if o != nil && !IsNil(o.XTotalCount) { return true } @@ -105,14 +108,22 @@ func (o *TokenPaginationHeaders) SetXTotalCount(v string) { } func (o TokenPaginationHeaders) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TokenPaginationHeaders) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Link != nil { + if !IsNil(o.Link) { toSerialize["link"] = o.Link } - if o.XTotalCount != nil { + if !IsNil(o.XTotalCount) { toSerialize["x-total-count"] = o.XTotalCount } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableTokenPaginationHeaders struct { diff --git a/internal/httpclient/model_ui_container.go b/internal/httpclient/model_ui_container.go index 10ffd75ea4a2..bc799d0dede1 100644 --- a/internal/httpclient/model_ui_container.go +++ b/internal/httpclient/model_ui_container.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiContainer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiContainer{} + // UiContainer Container represents a HTML Form. The container can work with both HTTP Form and JSON requests type UiContainer struct { // Action should be used as the form action URL ``. @@ -25,6 +30,8 @@ type UiContainer struct { Nodes []UiNode `json:"nodes"` } +type _UiContainer UiContainer + // NewUiContainer instantiates a new UiContainer object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -71,7 +78,7 @@ func (o *UiContainer) SetAction(v string) { // GetMessages returns the Messages field value if set, zero value otherwise. func (o *UiContainer) GetMessages() []UiText { - if o == nil || o.Messages == nil { + if o == nil || IsNil(o.Messages) { var ret []UiText return ret } @@ -81,7 +88,7 @@ func (o *UiContainer) GetMessages() []UiText { // GetMessagesOk returns a tuple with the Messages field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiContainer) GetMessagesOk() ([]UiText, bool) { - if o == nil || o.Messages == nil { + if o == nil || IsNil(o.Messages) { return nil, false } return o.Messages, true @@ -89,7 +96,7 @@ func (o *UiContainer) GetMessagesOk() ([]UiText, bool) { // HasMessages returns a boolean if a field has been set. func (o *UiContainer) HasMessages() bool { - if o != nil && o.Messages != nil { + if o != nil && !IsNil(o.Messages) { return true } @@ -150,20 +157,61 @@ func (o *UiContainer) SetNodes(v []UiNode) { } func (o UiContainer) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["action"] = o.Action + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if o.Messages != nil { + return json.Marshal(toSerialize) +} + +func (o UiContainer) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["action"] = o.Action + if !IsNil(o.Messages) { toSerialize["messages"] = o.Messages } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + toSerialize["nodes"] = o.Nodes + return toSerialize, nil +} + +func (o *UiContainer) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "action", + "method", + "nodes", } - if true { - toSerialize["nodes"] = o.Nodes + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUiContainer := _UiContainer{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiContainer) + + if err != nil { + return err + } + + *o = UiContainer(varUiContainer) + + return err } type NullableUiContainer struct { diff --git a/internal/httpclient/model_ui_node.go b/internal/httpclient/model_ui_node.go index ca88879a7414..4ca9b3ab7204 100644 --- a/internal/httpclient/model_ui_node.go +++ b/internal/httpclient/model_ui_node.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiNode type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNode{} + // UiNode Nodes are represented as HTML elements or their native UI equivalents. For example, a node can be an `` tag, or an `` but also `some plain text`. type UiNode struct { Attributes UiNodeAttributes `json:"attributes"` @@ -26,6 +31,8 @@ type UiNode struct { Type string `json:"type"` } +type _UiNode UiNode + // NewUiNode instantiates a new UiNode object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -169,23 +176,62 @@ func (o *UiNode) SetType(v string) { } func (o UiNode) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["attributes"] = o.Attributes + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if true { - toSerialize["group"] = o.Group + return json.Marshal(toSerialize) +} + +func (o UiNode) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["attributes"] = o.Attributes + toSerialize["group"] = o.Group + toSerialize["messages"] = o.Messages + toSerialize["meta"] = o.Meta + toSerialize["type"] = o.Type + return toSerialize, nil +} + +func (o *UiNode) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "attributes", + "group", + "messages", + "meta", + "type", } - if true { - toSerialize["messages"] = o.Messages + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["meta"] = o.Meta + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["type"] = o.Type + + varUiNode := _UiNode{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiNode) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UiNode(varUiNode) + + return err } type NullableUiNode struct { diff --git a/internal/httpclient/model_ui_node_anchor_attributes.go b/internal/httpclient/model_ui_node_anchor_attributes.go index 15cb492fe8eb..4f70bdb1a073 100644 --- a/internal/httpclient/model_ui_node_anchor_attributes.go +++ b/internal/httpclient/model_ui_node_anchor_attributes.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiNodeAnchorAttributes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNodeAnchorAttributes{} + // UiNodeAnchorAttributes struct for UiNodeAnchorAttributes type UiNodeAnchorAttributes struct { // The link's href (destination) URL. format: uri @@ -26,6 +31,8 @@ type UiNodeAnchorAttributes struct { Title UiText `json:"title"` } +type _UiNodeAnchorAttributes UiNodeAnchorAttributes + // NewUiNodeAnchorAttributes instantiates a new UiNodeAnchorAttributes object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -144,20 +151,60 @@ func (o *UiNodeAnchorAttributes) SetTitle(v UiText) { } func (o UiNodeAnchorAttributes) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UiNodeAnchorAttributes) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["href"] = o.Href + toSerialize["href"] = o.Href + toSerialize["id"] = o.Id + toSerialize["node_type"] = o.NodeType + toSerialize["title"] = o.Title + return toSerialize, nil +} + +func (o *UiNodeAnchorAttributes) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "href", + "id", + "node_type", + "title", } - if true { - toSerialize["id"] = o.Id + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["node_type"] = o.NodeType + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["title"] = o.Title + + varUiNodeAnchorAttributes := _UiNodeAnchorAttributes{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiNodeAnchorAttributes) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UiNodeAnchorAttributes(varUiNodeAnchorAttributes) + + return err } type NullableUiNodeAnchorAttributes struct { diff --git a/internal/httpclient/model_ui_node_attributes.go b/internal/httpclient/model_ui_node_attributes.go index 347be6f44a72..4869fae58a4f 100644 --- a/internal/httpclient/model_ui_node_attributes.go +++ b/internal/httpclient/model_ui_node_attributes.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -137,11 +137,11 @@ func (dst *UiNodeAttributes) UnmarshalJSON(data []byte) error { dst.UiNodeScriptAttributes = nil dst.UiNodeTextAttributes = nil - return fmt.Errorf("Data matches more than one schema in oneOf(UiNodeAttributes)") + return fmt.Errorf("data matches more than one schema in oneOf(UiNodeAttributes)") } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(UiNodeAttributes)") + return fmt.Errorf("data failed to match schemas in oneOf(UiNodeAttributes)") } } diff --git a/internal/httpclient/model_ui_node_image_attributes.go b/internal/httpclient/model_ui_node_image_attributes.go index 5b300b9548bd..f5e07582e692 100644 --- a/internal/httpclient/model_ui_node_image_attributes.go +++ b/internal/httpclient/model_ui_node_image_attributes.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiNodeImageAttributes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNodeImageAttributes{} + // UiNodeImageAttributes struct for UiNodeImageAttributes type UiNodeImageAttributes struct { // Height of the image @@ -29,6 +34,8 @@ type UiNodeImageAttributes struct { Width int64 `json:"width"` } +type _UiNodeImageAttributes UiNodeImageAttributes + // NewUiNodeImageAttributes instantiates a new UiNodeImageAttributes object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -172,23 +179,62 @@ func (o *UiNodeImageAttributes) SetWidth(v int64) { } func (o UiNodeImageAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["height"] = o.Height + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if true { - toSerialize["id"] = o.Id + return json.Marshal(toSerialize) +} + +func (o UiNodeImageAttributes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["height"] = o.Height + toSerialize["id"] = o.Id + toSerialize["node_type"] = o.NodeType + toSerialize["src"] = o.Src + toSerialize["width"] = o.Width + return toSerialize, nil +} + +func (o *UiNodeImageAttributes) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "height", + "id", + "node_type", + "src", + "width", } - if true { - toSerialize["node_type"] = o.NodeType + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["src"] = o.Src + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["width"] = o.Width + + varUiNodeImageAttributes := _UiNodeImageAttributes{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiNodeImageAttributes) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UiNodeImageAttributes(varUiNodeImageAttributes) + + return err } type NullableUiNodeImageAttributes struct { diff --git a/internal/httpclient/model_ui_node_input_attributes.go b/internal/httpclient/model_ui_node_input_attributes.go index 285456f2af98..3d3ff8b9b584 100644 --- a/internal/httpclient/model_ui_node_input_attributes.go +++ b/internal/httpclient/model_ui_node_input_attributes.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiNodeInputAttributes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNodeInputAttributes{} + // UiNodeInputAttributes InputAttributes represents the attributes of an input node type UiNodeInputAttributes struct { // The autocomplete attribute for the input. email InputAttributeAutocompleteEmail tel InputAttributeAutocompleteTel url InputAttributeAutocompleteUrl current-password InputAttributeAutocompleteCurrentPassword new-password InputAttributeAutocompleteNewPassword one-time-code InputAttributeAutocompleteOneTimeCode @@ -38,6 +43,8 @@ type UiNodeInputAttributes struct { Value interface{} `json:"value,omitempty"` } +type _UiNodeInputAttributes UiNodeInputAttributes + // NewUiNodeInputAttributes instantiates a new UiNodeInputAttributes object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -61,7 +68,7 @@ func NewUiNodeInputAttributesWithDefaults() *UiNodeInputAttributes { // GetAutocomplete returns the Autocomplete field value if set, zero value otherwise. func (o *UiNodeInputAttributes) GetAutocomplete() string { - if o == nil || o.Autocomplete == nil { + if o == nil || IsNil(o.Autocomplete) { var ret string return ret } @@ -71,7 +78,7 @@ func (o *UiNodeInputAttributes) GetAutocomplete() string { // GetAutocompleteOk returns a tuple with the Autocomplete field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiNodeInputAttributes) GetAutocompleteOk() (*string, bool) { - if o == nil || o.Autocomplete == nil { + if o == nil || IsNil(o.Autocomplete) { return nil, false } return o.Autocomplete, true @@ -79,7 +86,7 @@ func (o *UiNodeInputAttributes) GetAutocompleteOk() (*string, bool) { // HasAutocomplete returns a boolean if a field has been set. func (o *UiNodeInputAttributes) HasAutocomplete() bool { - if o != nil && o.Autocomplete != nil { + if o != nil && !IsNil(o.Autocomplete) { return true } @@ -117,7 +124,7 @@ func (o *UiNodeInputAttributes) SetDisabled(v bool) { // GetLabel returns the Label field value if set, zero value otherwise. func (o *UiNodeInputAttributes) GetLabel() UiText { - if o == nil || o.Label == nil { + if o == nil || IsNil(o.Label) { var ret UiText return ret } @@ -127,7 +134,7 @@ func (o *UiNodeInputAttributes) GetLabel() UiText { // GetLabelOk returns a tuple with the Label field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiNodeInputAttributes) GetLabelOk() (*UiText, bool) { - if o == nil || o.Label == nil { + if o == nil || IsNil(o.Label) { return nil, false } return o.Label, true @@ -135,7 +142,7 @@ func (o *UiNodeInputAttributes) GetLabelOk() (*UiText, bool) { // HasLabel returns a boolean if a field has been set. func (o *UiNodeInputAttributes) HasLabel() bool { - if o != nil && o.Label != nil { + if o != nil && !IsNil(o.Label) { return true } @@ -197,7 +204,7 @@ func (o *UiNodeInputAttributes) SetNodeType(v string) { // GetOnclick returns the Onclick field value if set, zero value otherwise. func (o *UiNodeInputAttributes) GetOnclick() string { - if o == nil || o.Onclick == nil { + if o == nil || IsNil(o.Onclick) { var ret string return ret } @@ -207,7 +214,7 @@ func (o *UiNodeInputAttributes) GetOnclick() string { // GetOnclickOk returns a tuple with the Onclick field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiNodeInputAttributes) GetOnclickOk() (*string, bool) { - if o == nil || o.Onclick == nil { + if o == nil || IsNil(o.Onclick) { return nil, false } return o.Onclick, true @@ -215,7 +222,7 @@ func (o *UiNodeInputAttributes) GetOnclickOk() (*string, bool) { // HasOnclick returns a boolean if a field has been set. func (o *UiNodeInputAttributes) HasOnclick() bool { - if o != nil && o.Onclick != nil { + if o != nil && !IsNil(o.Onclick) { return true } @@ -229,7 +236,7 @@ func (o *UiNodeInputAttributes) SetOnclick(v string) { // GetPattern returns the Pattern field value if set, zero value otherwise. func (o *UiNodeInputAttributes) GetPattern() string { - if o == nil || o.Pattern == nil { + if o == nil || IsNil(o.Pattern) { var ret string return ret } @@ -239,7 +246,7 @@ func (o *UiNodeInputAttributes) GetPattern() string { // GetPatternOk returns a tuple with the Pattern field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiNodeInputAttributes) GetPatternOk() (*string, bool) { - if o == nil || o.Pattern == nil { + if o == nil || IsNil(o.Pattern) { return nil, false } return o.Pattern, true @@ -247,7 +254,7 @@ func (o *UiNodeInputAttributes) GetPatternOk() (*string, bool) { // HasPattern returns a boolean if a field has been set. func (o *UiNodeInputAttributes) HasPattern() bool { - if o != nil && o.Pattern != nil { + if o != nil && !IsNil(o.Pattern) { return true } @@ -261,7 +268,7 @@ func (o *UiNodeInputAttributes) SetPattern(v string) { // GetRequired returns the Required field value if set, zero value otherwise. func (o *UiNodeInputAttributes) GetRequired() bool { - if o == nil || o.Required == nil { + if o == nil || IsNil(o.Required) { var ret bool return ret } @@ -271,7 +278,7 @@ func (o *UiNodeInputAttributes) GetRequired() bool { // GetRequiredOk returns a tuple with the Required field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiNodeInputAttributes) GetRequiredOk() (*bool, bool) { - if o == nil || o.Required == nil { + if o == nil || IsNil(o.Required) { return nil, false } return o.Required, true @@ -279,7 +286,7 @@ func (o *UiNodeInputAttributes) GetRequiredOk() (*bool, bool) { // HasRequired returns a boolean if a field has been set. func (o *UiNodeInputAttributes) HasRequired() bool { - if o != nil && o.Required != nil { + if o != nil && !IsNil(o.Required) { return true } @@ -328,7 +335,7 @@ func (o *UiNodeInputAttributes) GetValue() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *UiNodeInputAttributes) GetValueOk() (*interface{}, bool) { - if o == nil || o.Value == nil { + if o == nil || IsNil(o.Value) { return nil, false } return &o.Value, true @@ -336,7 +343,7 @@ func (o *UiNodeInputAttributes) GetValueOk() (*interface{}, bool) { // HasValue returns a boolean if a field has been set. func (o *UiNodeInputAttributes) HasValue() bool { - if o != nil && o.Value != nil { + if o != nil && IsNil(o.Value) { return true } @@ -349,38 +356,78 @@ func (o *UiNodeInputAttributes) SetValue(v interface{}) { } func (o UiNodeInputAttributes) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UiNodeInputAttributes) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Autocomplete != nil { + if !IsNil(o.Autocomplete) { toSerialize["autocomplete"] = o.Autocomplete } - if true { - toSerialize["disabled"] = o.Disabled - } - if o.Label != nil { + toSerialize["disabled"] = o.Disabled + if !IsNil(o.Label) { toSerialize["label"] = o.Label } - if true { - toSerialize["name"] = o.Name - } - if true { - toSerialize["node_type"] = o.NodeType - } - if o.Onclick != nil { + toSerialize["name"] = o.Name + toSerialize["node_type"] = o.NodeType + if !IsNil(o.Onclick) { toSerialize["onclick"] = o.Onclick } - if o.Pattern != nil { + if !IsNil(o.Pattern) { toSerialize["pattern"] = o.Pattern } - if o.Required != nil { + if !IsNil(o.Required) { toSerialize["required"] = o.Required } - if true { - toSerialize["type"] = o.Type - } + toSerialize["type"] = o.Type if o.Value != nil { toSerialize["value"] = o.Value } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UiNodeInputAttributes) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "disabled", + "name", + "node_type", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUiNodeInputAttributes := _UiNodeInputAttributes{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiNodeInputAttributes) + + if err != nil { + return err + } + + *o = UiNodeInputAttributes(varUiNodeInputAttributes) + + return err } type NullableUiNodeInputAttributes struct { diff --git a/internal/httpclient/model_ui_node_meta.go b/internal/httpclient/model_ui_node_meta.go index 88855b4d6c0c..c9ef8ebb1e3f 100644 --- a/internal/httpclient/model_ui_node_meta.go +++ b/internal/httpclient/model_ui_node_meta.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the UiNodeMeta type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNodeMeta{} + // UiNodeMeta This might include a label and other information that can optionally be used to render UIs. type UiNodeMeta struct { Label *UiText `json:"label,omitempty"` @@ -39,7 +42,7 @@ func NewUiNodeMetaWithDefaults() *UiNodeMeta { // GetLabel returns the Label field value if set, zero value otherwise. func (o *UiNodeMeta) GetLabel() UiText { - if o == nil || o.Label == nil { + if o == nil || IsNil(o.Label) { var ret UiText return ret } @@ -49,7 +52,7 @@ func (o *UiNodeMeta) GetLabel() UiText { // GetLabelOk returns a tuple with the Label field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiNodeMeta) GetLabelOk() (*UiText, bool) { - if o == nil || o.Label == nil { + if o == nil || IsNil(o.Label) { return nil, false } return o.Label, true @@ -57,7 +60,7 @@ func (o *UiNodeMeta) GetLabelOk() (*UiText, bool) { // HasLabel returns a boolean if a field has been set. func (o *UiNodeMeta) HasLabel() bool { - if o != nil && o.Label != nil { + if o != nil && !IsNil(o.Label) { return true } @@ -70,11 +73,19 @@ func (o *UiNodeMeta) SetLabel(v UiText) { } func (o UiNodeMeta) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UiNodeMeta) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Label != nil { + if !IsNil(o.Label) { toSerialize["label"] = o.Label } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableUiNodeMeta struct { diff --git a/internal/httpclient/model_ui_node_script_attributes.go b/internal/httpclient/model_ui_node_script_attributes.go index 21dca70cbe86..4e91e71dc30b 100644 --- a/internal/httpclient/model_ui_node_script_attributes.go +++ b/internal/httpclient/model_ui_node_script_attributes.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiNodeScriptAttributes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNodeScriptAttributes{} + // UiNodeScriptAttributes struct for UiNodeScriptAttributes type UiNodeScriptAttributes struct { // The script async type @@ -37,6 +42,8 @@ type UiNodeScriptAttributes struct { Type string `json:"type"` } +type _UiNodeScriptAttributes UiNodeScriptAttributes + // NewUiNodeScriptAttributes instantiates a new UiNodeScriptAttributes object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -280,35 +287,70 @@ func (o *UiNodeScriptAttributes) SetType(v string) { } func (o UiNodeScriptAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["async"] = o.Async - } - if true { - toSerialize["crossorigin"] = o.Crossorigin + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - if true { - toSerialize["id"] = o.Id - } - if true { - toSerialize["integrity"] = o.Integrity - } - if true { - toSerialize["node_type"] = o.NodeType - } - if true { - toSerialize["nonce"] = o.Nonce + return json.Marshal(toSerialize) +} + +func (o UiNodeScriptAttributes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["async"] = o.Async + toSerialize["crossorigin"] = o.Crossorigin + toSerialize["id"] = o.Id + toSerialize["integrity"] = o.Integrity + toSerialize["node_type"] = o.NodeType + toSerialize["nonce"] = o.Nonce + toSerialize["referrerpolicy"] = o.Referrerpolicy + toSerialize["src"] = o.Src + toSerialize["type"] = o.Type + return toSerialize, nil +} + +func (o *UiNodeScriptAttributes) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "async", + "crossorigin", + "id", + "integrity", + "node_type", + "nonce", + "referrerpolicy", + "src", + "type", } - if true { - toSerialize["referrerpolicy"] = o.Referrerpolicy + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["src"] = o.Src + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["type"] = o.Type + + varUiNodeScriptAttributes := _UiNodeScriptAttributes{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiNodeScriptAttributes) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UiNodeScriptAttributes(varUiNodeScriptAttributes) + + return err } type NullableUiNodeScriptAttributes struct { diff --git a/internal/httpclient/model_ui_node_text_attributes.go b/internal/httpclient/model_ui_node_text_attributes.go index 6199187b5d75..b653ecf9762a 100644 --- a/internal/httpclient/model_ui_node_text_attributes.go +++ b/internal/httpclient/model_ui_node_text_attributes.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiNodeTextAttributes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiNodeTextAttributes{} + // UiNodeTextAttributes struct for UiNodeTextAttributes type UiNodeTextAttributes struct { // A unique identifier @@ -24,6 +29,8 @@ type UiNodeTextAttributes struct { Text UiText `json:"text"` } +type _UiNodeTextAttributes UiNodeTextAttributes + // NewUiNodeTextAttributes instantiates a new UiNodeTextAttributes object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -117,17 +124,58 @@ func (o *UiNodeTextAttributes) SetText(v UiText) { } func (o UiNodeTextAttributes) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UiNodeTextAttributes) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["id"] = o.Id + toSerialize["id"] = o.Id + toSerialize["node_type"] = o.NodeType + toSerialize["text"] = o.Text + return toSerialize, nil +} + +func (o *UiNodeTextAttributes) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "node_type", + "text", } - if true { - toSerialize["node_type"] = o.NodeType + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["text"] = o.Text + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varUiNodeTextAttributes := _UiNodeTextAttributes{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiNodeTextAttributes) + + if err != nil { + return err + } + + *o = UiNodeTextAttributes(varUiNodeTextAttributes) + + return err } type NullableUiNodeTextAttributes struct { diff --git a/internal/httpclient/model_ui_text.go b/internal/httpclient/model_ui_text.go index 9189d34d39d1..c133009ea0ee 100644 --- a/internal/httpclient/model_ui_text.go +++ b/internal/httpclient/model_ui_text.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UiText type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UiText{} + // UiText struct for UiText type UiText struct { // The message's context. Useful when customizing messages. @@ -26,6 +31,8 @@ type UiText struct { Type string `json:"type"` } +type _UiText UiText + // NewUiText instantiates a new UiText object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -48,7 +55,7 @@ func NewUiTextWithDefaults() *UiText { // GetContext returns the Context field value if set, zero value otherwise. func (o *UiText) GetContext() map[string]interface{} { - if o == nil || o.Context == nil { + if o == nil || IsNil(o.Context) { var ret map[string]interface{} return ret } @@ -58,15 +65,15 @@ func (o *UiText) GetContext() map[string]interface{} { // GetContextOk returns a tuple with the Context field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UiText) GetContextOk() (map[string]interface{}, bool) { - if o == nil || o.Context == nil { - return nil, false + if o == nil || IsNil(o.Context) { + return map[string]interface{}{}, false } return o.Context, true } // HasContext returns a boolean if a field has been set. func (o *UiText) HasContext() bool { - if o != nil && o.Context != nil { + if o != nil && !IsNil(o.Context) { return true } @@ -151,20 +158,61 @@ func (o *UiText) SetType(v string) { } func (o UiText) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UiText) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Context != nil { + if !IsNil(o.Context) { toSerialize["context"] = o.Context } - if true { - toSerialize["id"] = o.Id + toSerialize["id"] = o.Id + toSerialize["text"] = o.Text + toSerialize["type"] = o.Type + return toSerialize, nil +} + +func (o *UiText) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "text", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["text"] = o.Text + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["type"] = o.Type + + varUiText := _UiText{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUiText) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UiText(varUiText) + + return err } type NullableUiText struct { diff --git a/internal/httpclient/model_update_identity_body.go b/internal/httpclient/model_update_identity_body.go index 9009e2a88b30..aad6654efb98 100644 --- a/internal/httpclient/model_update_identity_body.go +++ b/internal/httpclient/model_update_identity_body.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateIdentityBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateIdentityBody{} + // UpdateIdentityBody Update Identity Body type UpdateIdentityBody struct { Credentials *IdentityWithCredentials `json:"credentials,omitempty"` @@ -30,6 +35,8 @@ type UpdateIdentityBody struct { Traits map[string]interface{} `json:"traits"` } +type _UpdateIdentityBody UpdateIdentityBody + // NewUpdateIdentityBody instantiates a new UpdateIdentityBody object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -52,7 +59,7 @@ func NewUpdateIdentityBodyWithDefaults() *UpdateIdentityBody { // GetCredentials returns the Credentials field value if set, zero value otherwise. func (o *UpdateIdentityBody) GetCredentials() IdentityWithCredentials { - if o == nil || o.Credentials == nil { + if o == nil || IsNil(o.Credentials) { var ret IdentityWithCredentials return ret } @@ -62,7 +69,7 @@ func (o *UpdateIdentityBody) GetCredentials() IdentityWithCredentials { // GetCredentialsOk returns a tuple with the Credentials field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateIdentityBody) GetCredentialsOk() (*IdentityWithCredentials, bool) { - if o == nil || o.Credentials == nil { + if o == nil || IsNil(o.Credentials) { return nil, false } return o.Credentials, true @@ -70,7 +77,7 @@ func (o *UpdateIdentityBody) GetCredentialsOk() (*IdentityWithCredentials, bool) // HasCredentials returns a boolean if a field has been set. func (o *UpdateIdentityBody) HasCredentials() bool { - if o != nil && o.Credentials != nil { + if o != nil && !IsNil(o.Credentials) { return true } @@ -95,7 +102,7 @@ func (o *UpdateIdentityBody) GetMetadataAdmin() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *UpdateIdentityBody) GetMetadataAdminOk() (*interface{}, bool) { - if o == nil || o.MetadataAdmin == nil { + if o == nil || IsNil(o.MetadataAdmin) { return nil, false } return &o.MetadataAdmin, true @@ -103,7 +110,7 @@ func (o *UpdateIdentityBody) GetMetadataAdminOk() (*interface{}, bool) { // HasMetadataAdmin returns a boolean if a field has been set. func (o *UpdateIdentityBody) HasMetadataAdmin() bool { - if o != nil && o.MetadataAdmin != nil { + if o != nil && IsNil(o.MetadataAdmin) { return true } @@ -128,7 +135,7 @@ func (o *UpdateIdentityBody) GetMetadataPublic() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *UpdateIdentityBody) GetMetadataPublicOk() (*interface{}, bool) { - if o == nil || o.MetadataPublic == nil { + if o == nil || IsNil(o.MetadataPublic) { return nil, false } return &o.MetadataPublic, true @@ -136,7 +143,7 @@ func (o *UpdateIdentityBody) GetMetadataPublicOk() (*interface{}, bool) { // HasMetadataPublic returns a boolean if a field has been set. func (o *UpdateIdentityBody) HasMetadataPublic() bool { - if o != nil && o.MetadataPublic != nil { + if o != nil && IsNil(o.MetadataPublic) { return true } @@ -210,7 +217,7 @@ func (o *UpdateIdentityBody) GetTraits() map[string]interface{} { // and a boolean to check if the value has been set. func (o *UpdateIdentityBody) GetTraitsOk() (map[string]interface{}, bool) { if o == nil { - return nil, false + return map[string]interface{}{}, false } return o.Traits, true } @@ -221,8 +228,16 @@ func (o *UpdateIdentityBody) SetTraits(v map[string]interface{}) { } func (o UpdateIdentityBody) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateIdentityBody) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Credentials != nil { + if !IsNil(o.Credentials) { toSerialize["credentials"] = o.Credentials } if o.MetadataAdmin != nil { @@ -231,16 +246,49 @@ func (o UpdateIdentityBody) MarshalJSON() ([]byte, error) { if o.MetadataPublic != nil { toSerialize["metadata_public"] = o.MetadataPublic } - if true { - toSerialize["schema_id"] = o.SchemaId + toSerialize["schema_id"] = o.SchemaId + toSerialize["state"] = o.State + toSerialize["traits"] = o.Traits + return toSerialize, nil +} + +func (o *UpdateIdentityBody) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "schema_id", + "state", + "traits", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["state"] = o.State + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["traits"] = o.Traits + + varUpdateIdentityBody := _UpdateIdentityBody{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateIdentityBody) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UpdateIdentityBody(varUpdateIdentityBody) + + return err } type NullableUpdateIdentityBody struct { diff --git a/internal/httpclient/model_update_login_flow_body.go b/internal/httpclient/model_update_login_flow_body.go index 36033328e78d..0ba555f3aeb2 100644 --- a/internal/httpclient/model_update_login_flow_body.go +++ b/internal/httpclient/model_update_login_flow_body.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -159,11 +159,11 @@ func (dst *UpdateLoginFlowBody) UnmarshalJSON(data []byte) error { dst.UpdateLoginFlowWithTotpMethod = nil dst.UpdateLoginFlowWithWebAuthnMethod = nil - return fmt.Errorf("Data matches more than one schema in oneOf(UpdateLoginFlowBody)") + return fmt.Errorf("data matches more than one schema in oneOf(UpdateLoginFlowBody)") } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(UpdateLoginFlowBody)") + return fmt.Errorf("data failed to match schemas in oneOf(UpdateLoginFlowBody)") } } diff --git a/internal/httpclient/model_update_login_flow_with_code_method.go b/internal/httpclient/model_update_login_flow_with_code_method.go index bd97ab583ebc..a0341b379f10 100644 --- a/internal/httpclient/model_update_login_flow_with_code_method.go +++ b/internal/httpclient/model_update_login_flow_with_code_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateLoginFlowWithCodeMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLoginFlowWithCodeMethod{} + // UpdateLoginFlowWithCodeMethod Update Login flow using the code method type UpdateLoginFlowWithCodeMethod struct { // Code is the 6 digits code sent to the user @@ -29,6 +34,8 @@ type UpdateLoginFlowWithCodeMethod struct { Resend *string `json:"resend,omitempty"` } +type _UpdateLoginFlowWithCodeMethod UpdateLoginFlowWithCodeMethod + // NewUpdateLoginFlowWithCodeMethod instantiates a new UpdateLoginFlowWithCodeMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -50,7 +57,7 @@ func NewUpdateLoginFlowWithCodeMethodWithDefaults() *UpdateLoginFlowWithCodeMeth // GetCode returns the Code field value if set, zero value otherwise. func (o *UpdateLoginFlowWithCodeMethod) GetCode() string { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { var ret string return ret } @@ -60,7 +67,7 @@ func (o *UpdateLoginFlowWithCodeMethod) GetCode() string { // GetCodeOk returns a tuple with the Code field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithCodeMethod) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { return nil, false } return o.Code, true @@ -68,7 +75,7 @@ func (o *UpdateLoginFlowWithCodeMethod) GetCodeOk() (*string, bool) { // HasCode returns a boolean if a field has been set. func (o *UpdateLoginFlowWithCodeMethod) HasCode() bool { - if o != nil && o.Code != nil { + if o != nil && !IsNil(o.Code) { return true } @@ -106,7 +113,7 @@ func (o *UpdateLoginFlowWithCodeMethod) SetCsrfToken(v string) { // GetIdentifier returns the Identifier field value if set, zero value otherwise. func (o *UpdateLoginFlowWithCodeMethod) GetIdentifier() string { - if o == nil || o.Identifier == nil { + if o == nil || IsNil(o.Identifier) { var ret string return ret } @@ -116,7 +123,7 @@ func (o *UpdateLoginFlowWithCodeMethod) GetIdentifier() string { // GetIdentifierOk returns a tuple with the Identifier field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithCodeMethod) GetIdentifierOk() (*string, bool) { - if o == nil || o.Identifier == nil { + if o == nil || IsNil(o.Identifier) { return nil, false } return o.Identifier, true @@ -124,7 +131,7 @@ func (o *UpdateLoginFlowWithCodeMethod) GetIdentifierOk() (*string, bool) { // HasIdentifier returns a boolean if a field has been set. func (o *UpdateLoginFlowWithCodeMethod) HasIdentifier() bool { - if o != nil && o.Identifier != nil { + if o != nil && !IsNil(o.Identifier) { return true } @@ -162,7 +169,7 @@ func (o *UpdateLoginFlowWithCodeMethod) SetMethod(v string) { // GetResend returns the Resend field value if set, zero value otherwise. func (o *UpdateLoginFlowWithCodeMethod) GetResend() string { - if o == nil || o.Resend == nil { + if o == nil || IsNil(o.Resend) { var ret string return ret } @@ -172,7 +179,7 @@ func (o *UpdateLoginFlowWithCodeMethod) GetResend() string { // GetResendOk returns a tuple with the Resend field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithCodeMethod) GetResendOk() (*string, bool) { - if o == nil || o.Resend == nil { + if o == nil || IsNil(o.Resend) { return nil, false } return o.Resend, true @@ -180,7 +187,7 @@ func (o *UpdateLoginFlowWithCodeMethod) GetResendOk() (*string, bool) { // HasResend returns a boolean if a field has been set. func (o *UpdateLoginFlowWithCodeMethod) HasResend() bool { - if o != nil && o.Resend != nil { + if o != nil && !IsNil(o.Resend) { return true } @@ -193,23 +200,65 @@ func (o *UpdateLoginFlowWithCodeMethod) SetResend(v string) { } func (o UpdateLoginFlowWithCodeMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLoginFlowWithCodeMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Code != nil { + if !IsNil(o.Code) { toSerialize["code"] = o.Code } - if true { - toSerialize["csrf_token"] = o.CsrfToken - } - if o.Identifier != nil { + toSerialize["csrf_token"] = o.CsrfToken + if !IsNil(o.Identifier) { toSerialize["identifier"] = o.Identifier } - if true { - toSerialize["method"] = o.Method - } - if o.Resend != nil { + toSerialize["method"] = o.Method + if !IsNil(o.Resend) { toSerialize["resend"] = o.Resend } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateLoginFlowWithCodeMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "csrf_token", + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateLoginFlowWithCodeMethod := _UpdateLoginFlowWithCodeMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateLoginFlowWithCodeMethod) + + if err != nil { + return err + } + + *o = UpdateLoginFlowWithCodeMethod(varUpdateLoginFlowWithCodeMethod) + + return err } type NullableUpdateLoginFlowWithCodeMethod struct { diff --git a/internal/httpclient/model_update_login_flow_with_lookup_secret_method.go b/internal/httpclient/model_update_login_flow_with_lookup_secret_method.go index 3a0c81aa6b55..58c58eeb6adb 100644 --- a/internal/httpclient/model_update_login_flow_with_lookup_secret_method.go +++ b/internal/httpclient/model_update_login_flow_with_lookup_secret_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateLoginFlowWithLookupSecretMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLoginFlowWithLookupSecretMethod{} + // UpdateLoginFlowWithLookupSecretMethod Update Login Flow with Lookup Secret Method type UpdateLoginFlowWithLookupSecretMethod struct { // Sending the anti-csrf token is only required for browser login flows. @@ -25,6 +30,8 @@ type UpdateLoginFlowWithLookupSecretMethod struct { Method string `json:"method"` } +type _UpdateLoginFlowWithLookupSecretMethod UpdateLoginFlowWithLookupSecretMethod + // NewUpdateLoginFlowWithLookupSecretMethod instantiates a new UpdateLoginFlowWithLookupSecretMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -46,7 +53,7 @@ func NewUpdateLoginFlowWithLookupSecretMethodWithDefaults() *UpdateLoginFlowWith // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateLoginFlowWithLookupSecretMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -56,7 +63,7 @@ func (o *UpdateLoginFlowWithLookupSecretMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithLookupSecretMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -64,7 +71,7 @@ func (o *UpdateLoginFlowWithLookupSecretMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateLoginFlowWithLookupSecretMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -125,17 +132,59 @@ func (o *UpdateLoginFlowWithLookupSecretMethod) SetMethod(v string) { } func (o UpdateLoginFlowWithLookupSecretMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLoginFlowWithLookupSecretMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["lookup_secret"] = o.LookupSecret + toSerialize["lookup_secret"] = o.LookupSecret + toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateLoginFlowWithLookupSecretMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "lookup_secret", + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["method"] = o.Method + + varUpdateLoginFlowWithLookupSecretMethod := _UpdateLoginFlowWithLookupSecretMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateLoginFlowWithLookupSecretMethod) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UpdateLoginFlowWithLookupSecretMethod(varUpdateLoginFlowWithLookupSecretMethod) + + return err } type NullableUpdateLoginFlowWithLookupSecretMethod struct { diff --git a/internal/httpclient/model_update_login_flow_with_oidc_method.go b/internal/httpclient/model_update_login_flow_with_oidc_method.go index c196eb2121da..5462d3a9a665 100644 --- a/internal/httpclient/model_update_login_flow_with_oidc_method.go +++ b/internal/httpclient/model_update_login_flow_with_oidc_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateLoginFlowWithOidcMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLoginFlowWithOidcMethod{} + // UpdateLoginFlowWithOidcMethod Update Login Flow with OpenID Connect Method type UpdateLoginFlowWithOidcMethod struct { // The CSRF Token @@ -33,6 +38,8 @@ type UpdateLoginFlowWithOidcMethod struct { UpstreamParameters map[string]interface{} `json:"upstream_parameters,omitempty"` } +type _UpdateLoginFlowWithOidcMethod UpdateLoginFlowWithOidcMethod + // NewUpdateLoginFlowWithOidcMethod instantiates a new UpdateLoginFlowWithOidcMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -54,7 +61,7 @@ func NewUpdateLoginFlowWithOidcMethodWithDefaults() *UpdateLoginFlowWithOidcMeth // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateLoginFlowWithOidcMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -64,7 +71,7 @@ func (o *UpdateLoginFlowWithOidcMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithOidcMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -72,7 +79,7 @@ func (o *UpdateLoginFlowWithOidcMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateLoginFlowWithOidcMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -86,7 +93,7 @@ func (o *UpdateLoginFlowWithOidcMethod) SetCsrfToken(v string) { // GetIdToken returns the IdToken field value if set, zero value otherwise. func (o *UpdateLoginFlowWithOidcMethod) GetIdToken() string { - if o == nil || o.IdToken == nil { + if o == nil || IsNil(o.IdToken) { var ret string return ret } @@ -96,7 +103,7 @@ func (o *UpdateLoginFlowWithOidcMethod) GetIdToken() string { // GetIdTokenOk returns a tuple with the IdToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithOidcMethod) GetIdTokenOk() (*string, bool) { - if o == nil || o.IdToken == nil { + if o == nil || IsNil(o.IdToken) { return nil, false } return o.IdToken, true @@ -104,7 +111,7 @@ func (o *UpdateLoginFlowWithOidcMethod) GetIdTokenOk() (*string, bool) { // HasIdToken returns a boolean if a field has been set. func (o *UpdateLoginFlowWithOidcMethod) HasIdToken() bool { - if o != nil && o.IdToken != nil { + if o != nil && !IsNil(o.IdToken) { return true } @@ -118,7 +125,7 @@ func (o *UpdateLoginFlowWithOidcMethod) SetIdToken(v string) { // GetIdTokenNonce returns the IdTokenNonce field value if set, zero value otherwise. func (o *UpdateLoginFlowWithOidcMethod) GetIdTokenNonce() string { - if o == nil || o.IdTokenNonce == nil { + if o == nil || IsNil(o.IdTokenNonce) { var ret string return ret } @@ -128,7 +135,7 @@ func (o *UpdateLoginFlowWithOidcMethod) GetIdTokenNonce() string { // GetIdTokenNonceOk returns a tuple with the IdTokenNonce field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithOidcMethod) GetIdTokenNonceOk() (*string, bool) { - if o == nil || o.IdTokenNonce == nil { + if o == nil || IsNil(o.IdTokenNonce) { return nil, false } return o.IdTokenNonce, true @@ -136,7 +143,7 @@ func (o *UpdateLoginFlowWithOidcMethod) GetIdTokenNonceOk() (*string, bool) { // HasIdTokenNonce returns a boolean if a field has been set. func (o *UpdateLoginFlowWithOidcMethod) HasIdTokenNonce() bool { - if o != nil && o.IdTokenNonce != nil { + if o != nil && !IsNil(o.IdTokenNonce) { return true } @@ -198,7 +205,7 @@ func (o *UpdateLoginFlowWithOidcMethod) SetProvider(v string) { // GetTraits returns the Traits field value if set, zero value otherwise. func (o *UpdateLoginFlowWithOidcMethod) GetTraits() map[string]interface{} { - if o == nil || o.Traits == nil { + if o == nil || IsNil(o.Traits) { var ret map[string]interface{} return ret } @@ -208,15 +215,15 @@ func (o *UpdateLoginFlowWithOidcMethod) GetTraits() map[string]interface{} { // GetTraitsOk returns a tuple with the Traits field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithOidcMethod) GetTraitsOk() (map[string]interface{}, bool) { - if o == nil || o.Traits == nil { - return nil, false + if o == nil || IsNil(o.Traits) { + return map[string]interface{}{}, false } return o.Traits, true } // HasTraits returns a boolean if a field has been set. func (o *UpdateLoginFlowWithOidcMethod) HasTraits() bool { - if o != nil && o.Traits != nil { + if o != nil && !IsNil(o.Traits) { return true } @@ -230,7 +237,7 @@ func (o *UpdateLoginFlowWithOidcMethod) SetTraits(v map[string]interface{}) { // GetUpstreamParameters returns the UpstreamParameters field value if set, zero value otherwise. func (o *UpdateLoginFlowWithOidcMethod) GetUpstreamParameters() map[string]interface{} { - if o == nil || o.UpstreamParameters == nil { + if o == nil || IsNil(o.UpstreamParameters) { var ret map[string]interface{} return ret } @@ -240,15 +247,15 @@ func (o *UpdateLoginFlowWithOidcMethod) GetUpstreamParameters() map[string]inter // GetUpstreamParametersOk returns a tuple with the UpstreamParameters field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithOidcMethod) GetUpstreamParametersOk() (map[string]interface{}, bool) { - if o == nil || o.UpstreamParameters == nil { - return nil, false + if o == nil || IsNil(o.UpstreamParameters) { + return map[string]interface{}{}, false } return o.UpstreamParameters, true } // HasUpstreamParameters returns a boolean if a field has been set. func (o *UpdateLoginFlowWithOidcMethod) HasUpstreamParameters() bool { - if o != nil && o.UpstreamParameters != nil { + if o != nil && !IsNil(o.UpstreamParameters) { return true } @@ -261,29 +268,71 @@ func (o *UpdateLoginFlowWithOidcMethod) SetUpstreamParameters(v map[string]inter } func (o UpdateLoginFlowWithOidcMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLoginFlowWithOidcMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if o.IdToken != nil { + if !IsNil(o.IdToken) { toSerialize["id_token"] = o.IdToken } - if o.IdTokenNonce != nil { + if !IsNil(o.IdTokenNonce) { toSerialize["id_token_nonce"] = o.IdTokenNonce } - if true { - toSerialize["method"] = o.Method - } - if true { - toSerialize["provider"] = o.Provider - } - if o.Traits != nil { + toSerialize["method"] = o.Method + toSerialize["provider"] = o.Provider + if !IsNil(o.Traits) { toSerialize["traits"] = o.Traits } - if o.UpstreamParameters != nil { + if !IsNil(o.UpstreamParameters) { toSerialize["upstream_parameters"] = o.UpstreamParameters } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateLoginFlowWithOidcMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "provider", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateLoginFlowWithOidcMethod := _UpdateLoginFlowWithOidcMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateLoginFlowWithOidcMethod) + + if err != nil { + return err + } + + *o = UpdateLoginFlowWithOidcMethod(varUpdateLoginFlowWithOidcMethod) + + return err } type NullableUpdateLoginFlowWithOidcMethod struct { diff --git a/internal/httpclient/model_update_login_flow_with_password_method.go b/internal/httpclient/model_update_login_flow_with_password_method.go index 35a9b590bd04..bbacb98dd4c9 100644 --- a/internal/httpclient/model_update_login_flow_with_password_method.go +++ b/internal/httpclient/model_update_login_flow_with_password_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateLoginFlowWithPasswordMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLoginFlowWithPasswordMethod{} + // UpdateLoginFlowWithPasswordMethod Update Login Flow with Password Method type UpdateLoginFlowWithPasswordMethod struct { // Sending the anti-csrf token is only required for browser login flows. @@ -29,6 +34,8 @@ type UpdateLoginFlowWithPasswordMethod struct { PasswordIdentifier *string `json:"password_identifier,omitempty"` } +type _UpdateLoginFlowWithPasswordMethod UpdateLoginFlowWithPasswordMethod + // NewUpdateLoginFlowWithPasswordMethod instantiates a new UpdateLoginFlowWithPasswordMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -51,7 +58,7 @@ func NewUpdateLoginFlowWithPasswordMethodWithDefaults() *UpdateLoginFlowWithPass // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateLoginFlowWithPasswordMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -61,7 +68,7 @@ func (o *UpdateLoginFlowWithPasswordMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithPasswordMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -69,7 +76,7 @@ func (o *UpdateLoginFlowWithPasswordMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateLoginFlowWithPasswordMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -155,7 +162,7 @@ func (o *UpdateLoginFlowWithPasswordMethod) SetPassword(v string) { // GetPasswordIdentifier returns the PasswordIdentifier field value if set, zero value otherwise. func (o *UpdateLoginFlowWithPasswordMethod) GetPasswordIdentifier() string { - if o == nil || o.PasswordIdentifier == nil { + if o == nil || IsNil(o.PasswordIdentifier) { var ret string return ret } @@ -165,7 +172,7 @@ func (o *UpdateLoginFlowWithPasswordMethod) GetPasswordIdentifier() string { // GetPasswordIdentifierOk returns a tuple with the PasswordIdentifier field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithPasswordMethod) GetPasswordIdentifierOk() (*string, bool) { - if o == nil || o.PasswordIdentifier == nil { + if o == nil || IsNil(o.PasswordIdentifier) { return nil, false } return o.PasswordIdentifier, true @@ -173,7 +180,7 @@ func (o *UpdateLoginFlowWithPasswordMethod) GetPasswordIdentifierOk() (*string, // HasPasswordIdentifier returns a boolean if a field has been set. func (o *UpdateLoginFlowWithPasswordMethod) HasPasswordIdentifier() bool { - if o != nil && o.PasswordIdentifier != nil { + if o != nil && !IsNil(o.PasswordIdentifier) { return true } @@ -186,23 +193,64 @@ func (o *UpdateLoginFlowWithPasswordMethod) SetPasswordIdentifier(v string) { } func (o UpdateLoginFlowWithPasswordMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLoginFlowWithPasswordMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["identifier"] = o.Identifier + toSerialize["identifier"] = o.Identifier + toSerialize["method"] = o.Method + toSerialize["password"] = o.Password + if !IsNil(o.PasswordIdentifier) { + toSerialize["password_identifier"] = o.PasswordIdentifier } - if true { - toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateLoginFlowWithPasswordMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "identifier", + "method", + "password", } - if true { - toSerialize["password"] = o.Password + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if o.PasswordIdentifier != nil { - toSerialize["password_identifier"] = o.PasswordIdentifier + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varUpdateLoginFlowWithPasswordMethod := _UpdateLoginFlowWithPasswordMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateLoginFlowWithPasswordMethod) + + if err != nil { + return err + } + + *o = UpdateLoginFlowWithPasswordMethod(varUpdateLoginFlowWithPasswordMethod) + + return err } type NullableUpdateLoginFlowWithPasswordMethod struct { diff --git a/internal/httpclient/model_update_login_flow_with_totp_method.go b/internal/httpclient/model_update_login_flow_with_totp_method.go index 34d3b316dd01..9a1bcaabe0ff 100644 --- a/internal/httpclient/model_update_login_flow_with_totp_method.go +++ b/internal/httpclient/model_update_login_flow_with_totp_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateLoginFlowWithTotpMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLoginFlowWithTotpMethod{} + // UpdateLoginFlowWithTotpMethod Update Login Flow with TOTP Method type UpdateLoginFlowWithTotpMethod struct { // Sending the anti-csrf token is only required for browser login flows. @@ -25,6 +30,8 @@ type UpdateLoginFlowWithTotpMethod struct { TotpCode string `json:"totp_code"` } +type _UpdateLoginFlowWithTotpMethod UpdateLoginFlowWithTotpMethod + // NewUpdateLoginFlowWithTotpMethod instantiates a new UpdateLoginFlowWithTotpMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -46,7 +53,7 @@ func NewUpdateLoginFlowWithTotpMethodWithDefaults() *UpdateLoginFlowWithTotpMeth // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateLoginFlowWithTotpMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -56,7 +63,7 @@ func (o *UpdateLoginFlowWithTotpMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithTotpMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -64,7 +71,7 @@ func (o *UpdateLoginFlowWithTotpMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateLoginFlowWithTotpMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -125,17 +132,59 @@ func (o *UpdateLoginFlowWithTotpMethod) SetTotpCode(v string) { } func (o UpdateLoginFlowWithTotpMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLoginFlowWithTotpMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + toSerialize["totp_code"] = o.TotpCode + return toSerialize, nil +} + +func (o *UpdateLoginFlowWithTotpMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "totp_code", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["totp_code"] = o.TotpCode + + varUpdateLoginFlowWithTotpMethod := _UpdateLoginFlowWithTotpMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateLoginFlowWithTotpMethod) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UpdateLoginFlowWithTotpMethod(varUpdateLoginFlowWithTotpMethod) + + return err } type NullableUpdateLoginFlowWithTotpMethod struct { diff --git a/internal/httpclient/model_update_login_flow_with_web_authn_method.go b/internal/httpclient/model_update_login_flow_with_web_authn_method.go index d5d8554febb4..6ba1ddfe0d71 100644 --- a/internal/httpclient/model_update_login_flow_with_web_authn_method.go +++ b/internal/httpclient/model_update_login_flow_with_web_authn_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateLoginFlowWithWebAuthnMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLoginFlowWithWebAuthnMethod{} + // UpdateLoginFlowWithWebAuthnMethod Update Login Flow with WebAuthn Method type UpdateLoginFlowWithWebAuthnMethod struct { // Sending the anti-csrf token is only required for browser login flows. @@ -27,6 +32,8 @@ type UpdateLoginFlowWithWebAuthnMethod struct { WebauthnLogin *string `json:"webauthn_login,omitempty"` } +type _UpdateLoginFlowWithWebAuthnMethod UpdateLoginFlowWithWebAuthnMethod + // NewUpdateLoginFlowWithWebAuthnMethod instantiates a new UpdateLoginFlowWithWebAuthnMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -48,7 +55,7 @@ func NewUpdateLoginFlowWithWebAuthnMethodWithDefaults() *UpdateLoginFlowWithWebA // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateLoginFlowWithWebAuthnMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -58,7 +65,7 @@ func (o *UpdateLoginFlowWithWebAuthnMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithWebAuthnMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -66,7 +73,7 @@ func (o *UpdateLoginFlowWithWebAuthnMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateLoginFlowWithWebAuthnMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -128,7 +135,7 @@ func (o *UpdateLoginFlowWithWebAuthnMethod) SetMethod(v string) { // GetWebauthnLogin returns the WebauthnLogin field value if set, zero value otherwise. func (o *UpdateLoginFlowWithWebAuthnMethod) GetWebauthnLogin() string { - if o == nil || o.WebauthnLogin == nil { + if o == nil || IsNil(o.WebauthnLogin) { var ret string return ret } @@ -138,7 +145,7 @@ func (o *UpdateLoginFlowWithWebAuthnMethod) GetWebauthnLogin() string { // GetWebauthnLoginOk returns a tuple with the WebauthnLogin field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateLoginFlowWithWebAuthnMethod) GetWebauthnLoginOk() (*string, bool) { - if o == nil || o.WebauthnLogin == nil { + if o == nil || IsNil(o.WebauthnLogin) { return nil, false } return o.WebauthnLogin, true @@ -146,7 +153,7 @@ func (o *UpdateLoginFlowWithWebAuthnMethod) GetWebauthnLoginOk() (*string, bool) // HasWebauthnLogin returns a boolean if a field has been set. func (o *UpdateLoginFlowWithWebAuthnMethod) HasWebauthnLogin() bool { - if o != nil && o.WebauthnLogin != nil { + if o != nil && !IsNil(o.WebauthnLogin) { return true } @@ -159,20 +166,62 @@ func (o *UpdateLoginFlowWithWebAuthnMethod) SetWebauthnLogin(v string) { } func (o UpdateLoginFlowWithWebAuthnMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLoginFlowWithWebAuthnMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["identifier"] = o.Identifier + toSerialize["identifier"] = o.Identifier + toSerialize["method"] = o.Method + if !IsNil(o.WebauthnLogin) { + toSerialize["webauthn_login"] = o.WebauthnLogin } - if true { - toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateLoginFlowWithWebAuthnMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "identifier", + "method", } - if o.WebauthnLogin != nil { - toSerialize["webauthn_login"] = o.WebauthnLogin + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateLoginFlowWithWebAuthnMethod := _UpdateLoginFlowWithWebAuthnMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateLoginFlowWithWebAuthnMethod) + + if err != nil { + return err + } + + *o = UpdateLoginFlowWithWebAuthnMethod(varUpdateLoginFlowWithWebAuthnMethod) + + return err } type NullableUpdateLoginFlowWithWebAuthnMethod struct { diff --git a/internal/httpclient/model_update_recovery_flow_body.go b/internal/httpclient/model_update_recovery_flow_body.go index 6eea1d5d6b6a..3ea993b6cf9d 100644 --- a/internal/httpclient/model_update_recovery_flow_body.go +++ b/internal/httpclient/model_update_recovery_flow_body.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -71,11 +71,11 @@ func (dst *UpdateRecoveryFlowBody) UnmarshalJSON(data []byte) error { dst.UpdateRecoveryFlowWithCodeMethod = nil dst.UpdateRecoveryFlowWithLinkMethod = nil - return fmt.Errorf("Data matches more than one schema in oneOf(UpdateRecoveryFlowBody)") + return fmt.Errorf("data matches more than one schema in oneOf(UpdateRecoveryFlowBody)") } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(UpdateRecoveryFlowBody)") + return fmt.Errorf("data failed to match schemas in oneOf(UpdateRecoveryFlowBody)") } } diff --git a/internal/httpclient/model_update_recovery_flow_with_code_method.go b/internal/httpclient/model_update_recovery_flow_with_code_method.go index 8d440330c7b8..36e7ba8c6d46 100644 --- a/internal/httpclient/model_update_recovery_flow_with_code_method.go +++ b/internal/httpclient/model_update_recovery_flow_with_code_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateRecoveryFlowWithCodeMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRecoveryFlowWithCodeMethod{} + // UpdateRecoveryFlowWithCodeMethod Update Recovery Flow with Code Method type UpdateRecoveryFlowWithCodeMethod struct { // Code from the recovery email If you want to submit a code, use this field, but make sure to _not_ include the email field, as well. @@ -27,6 +32,8 @@ type UpdateRecoveryFlowWithCodeMethod struct { Method string `json:"method"` } +type _UpdateRecoveryFlowWithCodeMethod UpdateRecoveryFlowWithCodeMethod + // NewUpdateRecoveryFlowWithCodeMethod instantiates a new UpdateRecoveryFlowWithCodeMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -47,7 +54,7 @@ func NewUpdateRecoveryFlowWithCodeMethodWithDefaults() *UpdateRecoveryFlowWithCo // GetCode returns the Code field value if set, zero value otherwise. func (o *UpdateRecoveryFlowWithCodeMethod) GetCode() string { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { var ret string return ret } @@ -57,7 +64,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) GetCode() string { // GetCodeOk returns a tuple with the Code field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRecoveryFlowWithCodeMethod) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { return nil, false } return o.Code, true @@ -65,7 +72,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) GetCodeOk() (*string, bool) { // HasCode returns a boolean if a field has been set. func (o *UpdateRecoveryFlowWithCodeMethod) HasCode() bool { - if o != nil && o.Code != nil { + if o != nil && !IsNil(o.Code) { return true } @@ -79,7 +86,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) SetCode(v string) { // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRecoveryFlowWithCodeMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -89,7 +96,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRecoveryFlowWithCodeMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -97,7 +104,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateRecoveryFlowWithCodeMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -111,7 +118,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) SetCsrfToken(v string) { // GetEmail returns the Email field value if set, zero value otherwise. func (o *UpdateRecoveryFlowWithCodeMethod) GetEmail() string { - if o == nil || o.Email == nil { + if o == nil || IsNil(o.Email) { var ret string return ret } @@ -121,7 +128,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) GetEmail() string { // GetEmailOk returns a tuple with the Email field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRecoveryFlowWithCodeMethod) GetEmailOk() (*string, bool) { - if o == nil || o.Email == nil { + if o == nil || IsNil(o.Email) { return nil, false } return o.Email, true @@ -129,7 +136,7 @@ func (o *UpdateRecoveryFlowWithCodeMethod) GetEmailOk() (*string, bool) { // HasEmail returns a boolean if a field has been set. func (o *UpdateRecoveryFlowWithCodeMethod) HasEmail() bool { - if o != nil && o.Email != nil { + if o != nil && !IsNil(o.Email) { return true } @@ -166,20 +173,63 @@ func (o *UpdateRecoveryFlowWithCodeMethod) SetMethod(v string) { } func (o UpdateRecoveryFlowWithCodeMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRecoveryFlowWithCodeMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Code != nil { + if !IsNil(o.Code) { toSerialize["code"] = o.Code } - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if o.Email != nil { + if !IsNil(o.Email) { toSerialize["email"] = o.Email } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateRecoveryFlowWithCodeMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateRecoveryFlowWithCodeMethod := _UpdateRecoveryFlowWithCodeMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateRecoveryFlowWithCodeMethod) + + if err != nil { + return err + } + + *o = UpdateRecoveryFlowWithCodeMethod(varUpdateRecoveryFlowWithCodeMethod) + + return err } type NullableUpdateRecoveryFlowWithCodeMethod struct { diff --git a/internal/httpclient/model_update_recovery_flow_with_link_method.go b/internal/httpclient/model_update_recovery_flow_with_link_method.go index 8a8861d86f07..35bee4c8952c 100644 --- a/internal/httpclient/model_update_recovery_flow_with_link_method.go +++ b/internal/httpclient/model_update_recovery_flow_with_link_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateRecoveryFlowWithLinkMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRecoveryFlowWithLinkMethod{} + // UpdateRecoveryFlowWithLinkMethod Update Recovery Flow with Link Method type UpdateRecoveryFlowWithLinkMethod struct { // Sending the anti-csrf token is only required for browser login flows. @@ -25,6 +30,8 @@ type UpdateRecoveryFlowWithLinkMethod struct { Method string `json:"method"` } +type _UpdateRecoveryFlowWithLinkMethod UpdateRecoveryFlowWithLinkMethod + // NewUpdateRecoveryFlowWithLinkMethod instantiates a new UpdateRecoveryFlowWithLinkMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -46,7 +53,7 @@ func NewUpdateRecoveryFlowWithLinkMethodWithDefaults() *UpdateRecoveryFlowWithLi // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRecoveryFlowWithLinkMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -56,7 +63,7 @@ func (o *UpdateRecoveryFlowWithLinkMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRecoveryFlowWithLinkMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -64,7 +71,7 @@ func (o *UpdateRecoveryFlowWithLinkMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateRecoveryFlowWithLinkMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -125,17 +132,59 @@ func (o *UpdateRecoveryFlowWithLinkMethod) SetMethod(v string) { } func (o UpdateRecoveryFlowWithLinkMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRecoveryFlowWithLinkMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["email"] = o.Email + toSerialize["email"] = o.Email + toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateRecoveryFlowWithLinkMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "email", + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["method"] = o.Method + + varUpdateRecoveryFlowWithLinkMethod := _UpdateRecoveryFlowWithLinkMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateRecoveryFlowWithLinkMethod) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UpdateRecoveryFlowWithLinkMethod(varUpdateRecoveryFlowWithLinkMethod) + + return err } type NullableUpdateRecoveryFlowWithLinkMethod struct { diff --git a/internal/httpclient/model_update_registration_flow_body.go b/internal/httpclient/model_update_registration_flow_body.go index 0e36a95f635f..ff88ef9d4b31 100644 --- a/internal/httpclient/model_update_registration_flow_body.go +++ b/internal/httpclient/model_update_registration_flow_body.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -115,11 +115,11 @@ func (dst *UpdateRegistrationFlowBody) UnmarshalJSON(data []byte) error { dst.UpdateRegistrationFlowWithPasswordMethod = nil dst.UpdateRegistrationFlowWithWebAuthnMethod = nil - return fmt.Errorf("Data matches more than one schema in oneOf(UpdateRegistrationFlowBody)") + return fmt.Errorf("data matches more than one schema in oneOf(UpdateRegistrationFlowBody)") } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(UpdateRegistrationFlowBody)") + return fmt.Errorf("data failed to match schemas in oneOf(UpdateRegistrationFlowBody)") } } diff --git a/internal/httpclient/model_update_registration_flow_with_code_method.go b/internal/httpclient/model_update_registration_flow_with_code_method.go index 46b9126d666f..b33763bee073 100644 --- a/internal/httpclient/model_update_registration_flow_with_code_method.go +++ b/internal/httpclient/model_update_registration_flow_with_code_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateRegistrationFlowWithCodeMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRegistrationFlowWithCodeMethod{} + // UpdateRegistrationFlowWithCodeMethod Update Registration Flow with Code Method type UpdateRegistrationFlowWithCodeMethod struct { // The OTP Code sent to the user @@ -31,6 +36,8 @@ type UpdateRegistrationFlowWithCodeMethod struct { TransientPayload map[string]interface{} `json:"transient_payload,omitempty"` } +type _UpdateRegistrationFlowWithCodeMethod UpdateRegistrationFlowWithCodeMethod + // NewUpdateRegistrationFlowWithCodeMethod instantiates a new UpdateRegistrationFlowWithCodeMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -52,7 +59,7 @@ func NewUpdateRegistrationFlowWithCodeMethodWithDefaults() *UpdateRegistrationFl // GetCode returns the Code field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithCodeMethod) GetCode() string { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { var ret string return ret } @@ -62,7 +69,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetCode() string { // GetCodeOk returns a tuple with the Code field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithCodeMethod) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { return nil, false } return o.Code, true @@ -70,7 +77,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetCodeOk() (*string, bool) { // HasCode returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithCodeMethod) HasCode() bool { - if o != nil && o.Code != nil { + if o != nil && !IsNil(o.Code) { return true } @@ -84,7 +91,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) SetCode(v string) { // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithCodeMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -94,7 +101,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithCodeMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -102,7 +109,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithCodeMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -140,7 +147,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) SetMethod(v string) { // GetResend returns the Resend field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithCodeMethod) GetResend() string { - if o == nil || o.Resend == nil { + if o == nil || IsNil(o.Resend) { var ret string return ret } @@ -150,7 +157,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetResend() string { // GetResendOk returns a tuple with the Resend field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithCodeMethod) GetResendOk() (*string, bool) { - if o == nil || o.Resend == nil { + if o == nil || IsNil(o.Resend) { return nil, false } return o.Resend, true @@ -158,7 +165,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetResendOk() (*string, bool) { // HasResend returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithCodeMethod) HasResend() bool { - if o != nil && o.Resend != nil { + if o != nil && !IsNil(o.Resend) { return true } @@ -184,7 +191,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetTraits() map[string]interface{ // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithCodeMethod) GetTraitsOk() (map[string]interface{}, bool) { if o == nil { - return nil, false + return map[string]interface{}{}, false } return o.Traits, true } @@ -196,7 +203,7 @@ func (o *UpdateRegistrationFlowWithCodeMethod) SetTraits(v map[string]interface{ // GetTransientPayload returns the TransientPayload field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithCodeMethod) GetTransientPayload() map[string]interface{} { - if o == nil || o.TransientPayload == nil { + if o == nil || IsNil(o.TransientPayload) { var ret map[string]interface{} return ret } @@ -206,15 +213,15 @@ func (o *UpdateRegistrationFlowWithCodeMethod) GetTransientPayload() map[string] // GetTransientPayloadOk returns a tuple with the TransientPayload field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithCodeMethod) GetTransientPayloadOk() (map[string]interface{}, bool) { - if o == nil || o.TransientPayload == nil { - return nil, false + if o == nil || IsNil(o.TransientPayload) { + return map[string]interface{}{}, false } return o.TransientPayload, true } // HasTransientPayload returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithCodeMethod) HasTransientPayload() bool { - if o != nil && o.TransientPayload != nil { + if o != nil && !IsNil(o.TransientPayload) { return true } @@ -227,26 +234,68 @@ func (o *UpdateRegistrationFlowWithCodeMethod) SetTransientPayload(v map[string] } func (o UpdateRegistrationFlowWithCodeMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRegistrationFlowWithCodeMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Code != nil { + if !IsNil(o.Code) { toSerialize["code"] = o.Code } - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method - } - if o.Resend != nil { + toSerialize["method"] = o.Method + if !IsNil(o.Resend) { toSerialize["resend"] = o.Resend } - if true { - toSerialize["traits"] = o.Traits - } - if o.TransientPayload != nil { + toSerialize["traits"] = o.Traits + if !IsNil(o.TransientPayload) { toSerialize["transient_payload"] = o.TransientPayload } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateRegistrationFlowWithCodeMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "traits", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateRegistrationFlowWithCodeMethod := _UpdateRegistrationFlowWithCodeMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateRegistrationFlowWithCodeMethod) + + if err != nil { + return err + } + + *o = UpdateRegistrationFlowWithCodeMethod(varUpdateRegistrationFlowWithCodeMethod) + + return err } type NullableUpdateRegistrationFlowWithCodeMethod struct { diff --git a/internal/httpclient/model_update_registration_flow_with_oidc_method.go b/internal/httpclient/model_update_registration_flow_with_oidc_method.go index 509e978a0627..058422b9bfcf 100644 --- a/internal/httpclient/model_update_registration_flow_with_oidc_method.go +++ b/internal/httpclient/model_update_registration_flow_with_oidc_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateRegistrationFlowWithOidcMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRegistrationFlowWithOidcMethod{} + // UpdateRegistrationFlowWithOidcMethod Update Registration Flow with OpenID Connect Method type UpdateRegistrationFlowWithOidcMethod struct { // The CSRF Token @@ -35,6 +40,8 @@ type UpdateRegistrationFlowWithOidcMethod struct { UpstreamParameters map[string]interface{} `json:"upstream_parameters,omitempty"` } +type _UpdateRegistrationFlowWithOidcMethod UpdateRegistrationFlowWithOidcMethod + // NewUpdateRegistrationFlowWithOidcMethod instantiates a new UpdateRegistrationFlowWithOidcMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -56,7 +63,7 @@ func NewUpdateRegistrationFlowWithOidcMethodWithDefaults() *UpdateRegistrationFl // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithOidcMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -66,7 +73,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithOidcMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -74,7 +81,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithOidcMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -88,7 +95,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) SetCsrfToken(v string) { // GetIdToken returns the IdToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithOidcMethod) GetIdToken() string { - if o == nil || o.IdToken == nil { + if o == nil || IsNil(o.IdToken) { var ret string return ret } @@ -98,7 +105,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetIdToken() string { // GetIdTokenOk returns a tuple with the IdToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithOidcMethod) GetIdTokenOk() (*string, bool) { - if o == nil || o.IdToken == nil { + if o == nil || IsNil(o.IdToken) { return nil, false } return o.IdToken, true @@ -106,7 +113,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetIdTokenOk() (*string, bool) { // HasIdToken returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithOidcMethod) HasIdToken() bool { - if o != nil && o.IdToken != nil { + if o != nil && !IsNil(o.IdToken) { return true } @@ -120,7 +127,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) SetIdToken(v string) { // GetIdTokenNonce returns the IdTokenNonce field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithOidcMethod) GetIdTokenNonce() string { - if o == nil || o.IdTokenNonce == nil { + if o == nil || IsNil(o.IdTokenNonce) { var ret string return ret } @@ -130,7 +137,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetIdTokenNonce() string { // GetIdTokenNonceOk returns a tuple with the IdTokenNonce field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithOidcMethod) GetIdTokenNonceOk() (*string, bool) { - if o == nil || o.IdTokenNonce == nil { + if o == nil || IsNil(o.IdTokenNonce) { return nil, false } return o.IdTokenNonce, true @@ -138,7 +145,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetIdTokenNonceOk() (*string, boo // HasIdTokenNonce returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithOidcMethod) HasIdTokenNonce() bool { - if o != nil && o.IdTokenNonce != nil { + if o != nil && !IsNil(o.IdTokenNonce) { return true } @@ -200,7 +207,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) SetProvider(v string) { // GetTraits returns the Traits field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithOidcMethod) GetTraits() map[string]interface{} { - if o == nil || o.Traits == nil { + if o == nil || IsNil(o.Traits) { var ret map[string]interface{} return ret } @@ -210,15 +217,15 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetTraits() map[string]interface{ // GetTraitsOk returns a tuple with the Traits field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithOidcMethod) GetTraitsOk() (map[string]interface{}, bool) { - if o == nil || o.Traits == nil { - return nil, false + if o == nil || IsNil(o.Traits) { + return map[string]interface{}{}, false } return o.Traits, true } // HasTraits returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithOidcMethod) HasTraits() bool { - if o != nil && o.Traits != nil { + if o != nil && !IsNil(o.Traits) { return true } @@ -232,7 +239,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) SetTraits(v map[string]interface{ // GetTransientPayload returns the TransientPayload field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithOidcMethod) GetTransientPayload() map[string]interface{} { - if o == nil || o.TransientPayload == nil { + if o == nil || IsNil(o.TransientPayload) { var ret map[string]interface{} return ret } @@ -242,15 +249,15 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetTransientPayload() map[string] // GetTransientPayloadOk returns a tuple with the TransientPayload field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithOidcMethod) GetTransientPayloadOk() (map[string]interface{}, bool) { - if o == nil || o.TransientPayload == nil { - return nil, false + if o == nil || IsNil(o.TransientPayload) { + return map[string]interface{}{}, false } return o.TransientPayload, true } // HasTransientPayload returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithOidcMethod) HasTransientPayload() bool { - if o != nil && o.TransientPayload != nil { + if o != nil && !IsNil(o.TransientPayload) { return true } @@ -264,7 +271,7 @@ func (o *UpdateRegistrationFlowWithOidcMethod) SetTransientPayload(v map[string] // GetUpstreamParameters returns the UpstreamParameters field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithOidcMethod) GetUpstreamParameters() map[string]interface{} { - if o == nil || o.UpstreamParameters == nil { + if o == nil || IsNil(o.UpstreamParameters) { var ret map[string]interface{} return ret } @@ -274,15 +281,15 @@ func (o *UpdateRegistrationFlowWithOidcMethod) GetUpstreamParameters() map[strin // GetUpstreamParametersOk returns a tuple with the UpstreamParameters field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithOidcMethod) GetUpstreamParametersOk() (map[string]interface{}, bool) { - if o == nil || o.UpstreamParameters == nil { - return nil, false + if o == nil || IsNil(o.UpstreamParameters) { + return map[string]interface{}{}, false } return o.UpstreamParameters, true } // HasUpstreamParameters returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithOidcMethod) HasUpstreamParameters() bool { - if o != nil && o.UpstreamParameters != nil { + if o != nil && !IsNil(o.UpstreamParameters) { return true } @@ -295,32 +302,74 @@ func (o *UpdateRegistrationFlowWithOidcMethod) SetUpstreamParameters(v map[strin } func (o UpdateRegistrationFlowWithOidcMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRegistrationFlowWithOidcMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if o.IdToken != nil { + if !IsNil(o.IdToken) { toSerialize["id_token"] = o.IdToken } - if o.IdTokenNonce != nil { + if !IsNil(o.IdTokenNonce) { toSerialize["id_token_nonce"] = o.IdTokenNonce } - if true { - toSerialize["method"] = o.Method - } - if true { - toSerialize["provider"] = o.Provider - } - if o.Traits != nil { + toSerialize["method"] = o.Method + toSerialize["provider"] = o.Provider + if !IsNil(o.Traits) { toSerialize["traits"] = o.Traits } - if o.TransientPayload != nil { + if !IsNil(o.TransientPayload) { toSerialize["transient_payload"] = o.TransientPayload } - if o.UpstreamParameters != nil { + if !IsNil(o.UpstreamParameters) { toSerialize["upstream_parameters"] = o.UpstreamParameters } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateRegistrationFlowWithOidcMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "provider", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateRegistrationFlowWithOidcMethod := _UpdateRegistrationFlowWithOidcMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateRegistrationFlowWithOidcMethod) + + if err != nil { + return err + } + + *o = UpdateRegistrationFlowWithOidcMethod(varUpdateRegistrationFlowWithOidcMethod) + + return err } type NullableUpdateRegistrationFlowWithOidcMethod struct { diff --git a/internal/httpclient/model_update_registration_flow_with_password_method.go b/internal/httpclient/model_update_registration_flow_with_password_method.go index 3a86a3002c88..b5395d031a2f 100644 --- a/internal/httpclient/model_update_registration_flow_with_password_method.go +++ b/internal/httpclient/model_update_registration_flow_with_password_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateRegistrationFlowWithPasswordMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRegistrationFlowWithPasswordMethod{} + // UpdateRegistrationFlowWithPasswordMethod Update Registration Flow with Password Method type UpdateRegistrationFlowWithPasswordMethod struct { // The CSRF Token @@ -29,6 +34,8 @@ type UpdateRegistrationFlowWithPasswordMethod struct { TransientPayload map[string]interface{} `json:"transient_payload,omitempty"` } +type _UpdateRegistrationFlowWithPasswordMethod UpdateRegistrationFlowWithPasswordMethod + // NewUpdateRegistrationFlowWithPasswordMethod instantiates a new UpdateRegistrationFlowWithPasswordMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -51,7 +58,7 @@ func NewUpdateRegistrationFlowWithPasswordMethodWithDefaults() *UpdateRegistrati // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithPasswordMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -61,7 +68,7 @@ func (o *UpdateRegistrationFlowWithPasswordMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithPasswordMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -69,7 +76,7 @@ func (o *UpdateRegistrationFlowWithPasswordMethod) GetCsrfTokenOk() (*string, bo // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithPasswordMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -143,7 +150,7 @@ func (o *UpdateRegistrationFlowWithPasswordMethod) GetTraits() map[string]interf // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithPasswordMethod) GetTraitsOk() (map[string]interface{}, bool) { if o == nil { - return nil, false + return map[string]interface{}{}, false } return o.Traits, true } @@ -155,7 +162,7 @@ func (o *UpdateRegistrationFlowWithPasswordMethod) SetTraits(v map[string]interf // GetTransientPayload returns the TransientPayload field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithPasswordMethod) GetTransientPayload() map[string]interface{} { - if o == nil || o.TransientPayload == nil { + if o == nil || IsNil(o.TransientPayload) { var ret map[string]interface{} return ret } @@ -165,15 +172,15 @@ func (o *UpdateRegistrationFlowWithPasswordMethod) GetTransientPayload() map[str // GetTransientPayloadOk returns a tuple with the TransientPayload field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithPasswordMethod) GetTransientPayloadOk() (map[string]interface{}, bool) { - if o == nil || o.TransientPayload == nil { - return nil, false + if o == nil || IsNil(o.TransientPayload) { + return map[string]interface{}{}, false } return o.TransientPayload, true } // HasTransientPayload returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithPasswordMethod) HasTransientPayload() bool { - if o != nil && o.TransientPayload != nil { + if o != nil && !IsNil(o.TransientPayload) { return true } @@ -186,23 +193,64 @@ func (o *UpdateRegistrationFlowWithPasswordMethod) SetTransientPayload(v map[str } func (o UpdateRegistrationFlowWithPasswordMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRegistrationFlowWithPasswordMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + toSerialize["password"] = o.Password + toSerialize["traits"] = o.Traits + if !IsNil(o.TransientPayload) { + toSerialize["transient_payload"] = o.TransientPayload } - if true { - toSerialize["password"] = o.Password + return toSerialize, nil +} + +func (o *UpdateRegistrationFlowWithPasswordMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "password", + "traits", } - if true { - toSerialize["traits"] = o.Traits + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if o.TransientPayload != nil { - toSerialize["transient_payload"] = o.TransientPayload + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varUpdateRegistrationFlowWithPasswordMethod := _UpdateRegistrationFlowWithPasswordMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateRegistrationFlowWithPasswordMethod) + + if err != nil { + return err + } + + *o = UpdateRegistrationFlowWithPasswordMethod(varUpdateRegistrationFlowWithPasswordMethod) + + return err } type NullableUpdateRegistrationFlowWithPasswordMethod struct { diff --git a/internal/httpclient/model_update_registration_flow_with_web_authn_method.go b/internal/httpclient/model_update_registration_flow_with_web_authn_method.go index 1249f645c0a1..3b38da142447 100644 --- a/internal/httpclient/model_update_registration_flow_with_web_authn_method.go +++ b/internal/httpclient/model_update_registration_flow_with_web_authn_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateRegistrationFlowWithWebAuthnMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRegistrationFlowWithWebAuthnMethod{} + // UpdateRegistrationFlowWithWebAuthnMethod Update Registration Flow with WebAuthn Method type UpdateRegistrationFlowWithWebAuthnMethod struct { // CSRFToken is the anti-CSRF token @@ -31,6 +36,8 @@ type UpdateRegistrationFlowWithWebAuthnMethod struct { WebauthnRegisterDisplayname *string `json:"webauthn_register_displayname,omitempty"` } +type _UpdateRegistrationFlowWithWebAuthnMethod UpdateRegistrationFlowWithWebAuthnMethod + // NewUpdateRegistrationFlowWithWebAuthnMethod instantiates a new UpdateRegistrationFlowWithWebAuthnMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -52,7 +59,7 @@ func NewUpdateRegistrationFlowWithWebAuthnMethodWithDefaults() *UpdateRegistrati // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -62,7 +69,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -70,7 +77,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetCsrfTokenOk() (*string, bo // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -120,7 +127,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetTraits() map[string]interf // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetTraitsOk() (map[string]interface{}, bool) { if o == nil { - return nil, false + return map[string]interface{}{}, false } return o.Traits, true } @@ -132,7 +139,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) SetTraits(v map[string]interf // GetTransientPayload returns the TransientPayload field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetTransientPayload() map[string]interface{} { - if o == nil || o.TransientPayload == nil { + if o == nil || IsNil(o.TransientPayload) { var ret map[string]interface{} return ret } @@ -142,15 +149,15 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetTransientPayload() map[str // GetTransientPayloadOk returns a tuple with the TransientPayload field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetTransientPayloadOk() (map[string]interface{}, bool) { - if o == nil || o.TransientPayload == nil { - return nil, false + if o == nil || IsNil(o.TransientPayload) { + return map[string]interface{}{}, false } return o.TransientPayload, true } // HasTransientPayload returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) HasTransientPayload() bool { - if o != nil && o.TransientPayload != nil { + if o != nil && !IsNil(o.TransientPayload) { return true } @@ -164,7 +171,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) SetTransientPayload(v map[str // GetWebauthnRegister returns the WebauthnRegister field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegister() string { - if o == nil || o.WebauthnRegister == nil { + if o == nil || IsNil(o.WebauthnRegister) { var ret string return ret } @@ -174,7 +181,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegister() string // GetWebauthnRegisterOk returns a tuple with the WebauthnRegister field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegisterOk() (*string, bool) { - if o == nil || o.WebauthnRegister == nil { + if o == nil || IsNil(o.WebauthnRegister) { return nil, false } return o.WebauthnRegister, true @@ -182,7 +189,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegisterOk() (*str // HasWebauthnRegister returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) HasWebauthnRegister() bool { - if o != nil && o.WebauthnRegister != nil { + if o != nil && !IsNil(o.WebauthnRegister) { return true } @@ -196,7 +203,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) SetWebauthnRegister(v string) // GetWebauthnRegisterDisplayname returns the WebauthnRegisterDisplayname field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegisterDisplayname() string { - if o == nil || o.WebauthnRegisterDisplayname == nil { + if o == nil || IsNil(o.WebauthnRegisterDisplayname) { var ret string return ret } @@ -206,7 +213,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegisterDisplaynam // GetWebauthnRegisterDisplaynameOk returns a tuple with the WebauthnRegisterDisplayname field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegisterDisplaynameOk() (*string, bool) { - if o == nil || o.WebauthnRegisterDisplayname == nil { + if o == nil || IsNil(o.WebauthnRegisterDisplayname) { return nil, false } return o.WebauthnRegisterDisplayname, true @@ -214,7 +221,7 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) GetWebauthnRegisterDisplaynam // HasWebauthnRegisterDisplayname returns a boolean if a field has been set. func (o *UpdateRegistrationFlowWithWebAuthnMethod) HasWebauthnRegisterDisplayname() bool { - if o != nil && o.WebauthnRegisterDisplayname != nil { + if o != nil && !IsNil(o.WebauthnRegisterDisplayname) { return true } @@ -227,26 +234,68 @@ func (o *UpdateRegistrationFlowWithWebAuthnMethod) SetWebauthnRegisterDisplaynam } func (o UpdateRegistrationFlowWithWebAuthnMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRegistrationFlowWithWebAuthnMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method - } - if true { - toSerialize["traits"] = o.Traits - } - if o.TransientPayload != nil { + toSerialize["method"] = o.Method + toSerialize["traits"] = o.Traits + if !IsNil(o.TransientPayload) { toSerialize["transient_payload"] = o.TransientPayload } - if o.WebauthnRegister != nil { + if !IsNil(o.WebauthnRegister) { toSerialize["webauthn_register"] = o.WebauthnRegister } - if o.WebauthnRegisterDisplayname != nil { + if !IsNil(o.WebauthnRegisterDisplayname) { toSerialize["webauthn_register_displayname"] = o.WebauthnRegisterDisplayname } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateRegistrationFlowWithWebAuthnMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "traits", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateRegistrationFlowWithWebAuthnMethod := _UpdateRegistrationFlowWithWebAuthnMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateRegistrationFlowWithWebAuthnMethod) + + if err != nil { + return err + } + + *o = UpdateRegistrationFlowWithWebAuthnMethod(varUpdateRegistrationFlowWithWebAuthnMethod) + + return err } type NullableUpdateRegistrationFlowWithWebAuthnMethod struct { diff --git a/internal/httpclient/model_update_settings_flow_body.go b/internal/httpclient/model_update_settings_flow_body.go index 064ff9b771dd..f7e0bac2f3f6 100644 --- a/internal/httpclient/model_update_settings_flow_body.go +++ b/internal/httpclient/model_update_settings_flow_body.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -159,11 +159,11 @@ func (dst *UpdateSettingsFlowBody) UnmarshalJSON(data []byte) error { dst.UpdateSettingsFlowWithTotpMethod = nil dst.UpdateSettingsFlowWithWebAuthnMethod = nil - return fmt.Errorf("Data matches more than one schema in oneOf(UpdateSettingsFlowBody)") + return fmt.Errorf("data matches more than one schema in oneOf(UpdateSettingsFlowBody)") } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(UpdateSettingsFlowBody)") + return fmt.Errorf("data failed to match schemas in oneOf(UpdateSettingsFlowBody)") } } diff --git a/internal/httpclient/model_update_settings_flow_with_lookup_method.go b/internal/httpclient/model_update_settings_flow_with_lookup_method.go index 96a12cb7f9e2..e3d84aa62fa3 100644 --- a/internal/httpclient/model_update_settings_flow_with_lookup_method.go +++ b/internal/httpclient/model_update_settings_flow_with_lookup_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateSettingsFlowWithLookupMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSettingsFlowWithLookupMethod{} + // UpdateSettingsFlowWithLookupMethod Update Settings Flow with Lookup Method type UpdateSettingsFlowWithLookupMethod struct { // CSRFToken is the anti-CSRF token @@ -31,6 +36,8 @@ type UpdateSettingsFlowWithLookupMethod struct { Method string `json:"method"` } +type _UpdateSettingsFlowWithLookupMethod UpdateSettingsFlowWithLookupMethod + // NewUpdateSettingsFlowWithLookupMethod instantiates a new UpdateSettingsFlowWithLookupMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -51,7 +58,7 @@ func NewUpdateSettingsFlowWithLookupMethodWithDefaults() *UpdateSettingsFlowWith // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithLookupMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -61,7 +68,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithLookupMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -69,7 +76,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithLookupMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -83,7 +90,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) SetCsrfToken(v string) { // GetLookupSecretConfirm returns the LookupSecretConfirm field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretConfirm() bool { - if o == nil || o.LookupSecretConfirm == nil { + if o == nil || IsNil(o.LookupSecretConfirm) { var ret bool return ret } @@ -93,7 +100,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretConfirm() bool { // GetLookupSecretConfirmOk returns a tuple with the LookupSecretConfirm field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretConfirmOk() (*bool, bool) { - if o == nil || o.LookupSecretConfirm == nil { + if o == nil || IsNil(o.LookupSecretConfirm) { return nil, false } return o.LookupSecretConfirm, true @@ -101,7 +108,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretConfirmOk() (*bool, // HasLookupSecretConfirm returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithLookupMethod) HasLookupSecretConfirm() bool { - if o != nil && o.LookupSecretConfirm != nil { + if o != nil && !IsNil(o.LookupSecretConfirm) { return true } @@ -115,7 +122,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) SetLookupSecretConfirm(v bool) { // GetLookupSecretDisable returns the LookupSecretDisable field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretDisable() bool { - if o == nil || o.LookupSecretDisable == nil { + if o == nil || IsNil(o.LookupSecretDisable) { var ret bool return ret } @@ -125,7 +132,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretDisable() bool { // GetLookupSecretDisableOk returns a tuple with the LookupSecretDisable field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretDisableOk() (*bool, bool) { - if o == nil || o.LookupSecretDisable == nil { + if o == nil || IsNil(o.LookupSecretDisable) { return nil, false } return o.LookupSecretDisable, true @@ -133,7 +140,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretDisableOk() (*bool, // HasLookupSecretDisable returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithLookupMethod) HasLookupSecretDisable() bool { - if o != nil && o.LookupSecretDisable != nil { + if o != nil && !IsNil(o.LookupSecretDisable) { return true } @@ -147,7 +154,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) SetLookupSecretDisable(v bool) { // GetLookupSecretRegenerate returns the LookupSecretRegenerate field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretRegenerate() bool { - if o == nil || o.LookupSecretRegenerate == nil { + if o == nil || IsNil(o.LookupSecretRegenerate) { var ret bool return ret } @@ -157,7 +164,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretRegenerate() bool { // GetLookupSecretRegenerateOk returns a tuple with the LookupSecretRegenerate field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretRegenerateOk() (*bool, bool) { - if o == nil || o.LookupSecretRegenerate == nil { + if o == nil || IsNil(o.LookupSecretRegenerate) { return nil, false } return o.LookupSecretRegenerate, true @@ -165,7 +172,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretRegenerateOk() (*boo // HasLookupSecretRegenerate returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithLookupMethod) HasLookupSecretRegenerate() bool { - if o != nil && o.LookupSecretRegenerate != nil { + if o != nil && !IsNil(o.LookupSecretRegenerate) { return true } @@ -179,7 +186,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) SetLookupSecretRegenerate(v bool) { // GetLookupSecretReveal returns the LookupSecretReveal field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretReveal() bool { - if o == nil || o.LookupSecretReveal == nil { + if o == nil || IsNil(o.LookupSecretReveal) { var ret bool return ret } @@ -189,7 +196,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretReveal() bool { // GetLookupSecretRevealOk returns a tuple with the LookupSecretReveal field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretRevealOk() (*bool, bool) { - if o == nil || o.LookupSecretReveal == nil { + if o == nil || IsNil(o.LookupSecretReveal) { return nil, false } return o.LookupSecretReveal, true @@ -197,7 +204,7 @@ func (o *UpdateSettingsFlowWithLookupMethod) GetLookupSecretRevealOk() (*bool, b // HasLookupSecretReveal returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithLookupMethod) HasLookupSecretReveal() bool { - if o != nil && o.LookupSecretReveal != nil { + if o != nil && !IsNil(o.LookupSecretReveal) { return true } @@ -234,26 +241,69 @@ func (o *UpdateSettingsFlowWithLookupMethod) SetMethod(v string) { } func (o UpdateSettingsFlowWithLookupMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateSettingsFlowWithLookupMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if o.LookupSecretConfirm != nil { + if !IsNil(o.LookupSecretConfirm) { toSerialize["lookup_secret_confirm"] = o.LookupSecretConfirm } - if o.LookupSecretDisable != nil { + if !IsNil(o.LookupSecretDisable) { toSerialize["lookup_secret_disable"] = o.LookupSecretDisable } - if o.LookupSecretRegenerate != nil { + if !IsNil(o.LookupSecretRegenerate) { toSerialize["lookup_secret_regenerate"] = o.LookupSecretRegenerate } - if o.LookupSecretReveal != nil { + if !IsNil(o.LookupSecretReveal) { toSerialize["lookup_secret_reveal"] = o.LookupSecretReveal } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateSettingsFlowWithLookupMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateSettingsFlowWithLookupMethod := _UpdateSettingsFlowWithLookupMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateSettingsFlowWithLookupMethod) + + if err != nil { + return err + } + + *o = UpdateSettingsFlowWithLookupMethod(varUpdateSettingsFlowWithLookupMethod) + + return err } type NullableUpdateSettingsFlowWithLookupMethod struct { diff --git a/internal/httpclient/model_update_settings_flow_with_oidc_method.go b/internal/httpclient/model_update_settings_flow_with_oidc_method.go index 3008436d8b27..65cd9829ad61 100644 --- a/internal/httpclient/model_update_settings_flow_with_oidc_method.go +++ b/internal/httpclient/model_update_settings_flow_with_oidc_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateSettingsFlowWithOidcMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSettingsFlowWithOidcMethod{} + // UpdateSettingsFlowWithOidcMethod Update Settings Flow with OpenID Connect Method type UpdateSettingsFlowWithOidcMethod struct { // Flow ID is the flow's ID. in: query @@ -31,6 +36,8 @@ type UpdateSettingsFlowWithOidcMethod struct { UpstreamParameters map[string]interface{} `json:"upstream_parameters,omitempty"` } +type _UpdateSettingsFlowWithOidcMethod UpdateSettingsFlowWithOidcMethod + // NewUpdateSettingsFlowWithOidcMethod instantiates a new UpdateSettingsFlowWithOidcMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -51,7 +58,7 @@ func NewUpdateSettingsFlowWithOidcMethodWithDefaults() *UpdateSettingsFlowWithOi // GetFlow returns the Flow field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithOidcMethod) GetFlow() string { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { var ret string return ret } @@ -61,7 +68,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetFlow() string { // GetFlowOk returns a tuple with the Flow field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithOidcMethod) GetFlowOk() (*string, bool) { - if o == nil || o.Flow == nil { + if o == nil || IsNil(o.Flow) { return nil, false } return o.Flow, true @@ -69,7 +76,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetFlowOk() (*string, bool) { // HasFlow returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithOidcMethod) HasFlow() bool { - if o != nil && o.Flow != nil { + if o != nil && !IsNil(o.Flow) { return true } @@ -83,7 +90,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) SetFlow(v string) { // GetLink returns the Link field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithOidcMethod) GetLink() string { - if o == nil || o.Link == nil { + if o == nil || IsNil(o.Link) { var ret string return ret } @@ -93,7 +100,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetLink() string { // GetLinkOk returns a tuple with the Link field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithOidcMethod) GetLinkOk() (*string, bool) { - if o == nil || o.Link == nil { + if o == nil || IsNil(o.Link) { return nil, false } return o.Link, true @@ -101,7 +108,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetLinkOk() (*string, bool) { // HasLink returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithOidcMethod) HasLink() bool { - if o != nil && o.Link != nil { + if o != nil && !IsNil(o.Link) { return true } @@ -139,7 +146,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) SetMethod(v string) { // GetTraits returns the Traits field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithOidcMethod) GetTraits() map[string]interface{} { - if o == nil || o.Traits == nil { + if o == nil || IsNil(o.Traits) { var ret map[string]interface{} return ret } @@ -149,15 +156,15 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetTraits() map[string]interface{} { // GetTraitsOk returns a tuple with the Traits field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithOidcMethod) GetTraitsOk() (map[string]interface{}, bool) { - if o == nil || o.Traits == nil { - return nil, false + if o == nil || IsNil(o.Traits) { + return map[string]interface{}{}, false } return o.Traits, true } // HasTraits returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithOidcMethod) HasTraits() bool { - if o != nil && o.Traits != nil { + if o != nil && !IsNil(o.Traits) { return true } @@ -171,7 +178,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) SetTraits(v map[string]interface{}) { // GetUnlink returns the Unlink field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithOidcMethod) GetUnlink() string { - if o == nil || o.Unlink == nil { + if o == nil || IsNil(o.Unlink) { var ret string return ret } @@ -181,7 +188,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetUnlink() string { // GetUnlinkOk returns a tuple with the Unlink field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithOidcMethod) GetUnlinkOk() (*string, bool) { - if o == nil || o.Unlink == nil { + if o == nil || IsNil(o.Unlink) { return nil, false } return o.Unlink, true @@ -189,7 +196,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetUnlinkOk() (*string, bool) { // HasUnlink returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithOidcMethod) HasUnlink() bool { - if o != nil && o.Unlink != nil { + if o != nil && !IsNil(o.Unlink) { return true } @@ -203,7 +210,7 @@ func (o *UpdateSettingsFlowWithOidcMethod) SetUnlink(v string) { // GetUpstreamParameters returns the UpstreamParameters field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithOidcMethod) GetUpstreamParameters() map[string]interface{} { - if o == nil || o.UpstreamParameters == nil { + if o == nil || IsNil(o.UpstreamParameters) { var ret map[string]interface{} return ret } @@ -213,15 +220,15 @@ func (o *UpdateSettingsFlowWithOidcMethod) GetUpstreamParameters() map[string]in // GetUpstreamParametersOk returns a tuple with the UpstreamParameters field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithOidcMethod) GetUpstreamParametersOk() (map[string]interface{}, bool) { - if o == nil || o.UpstreamParameters == nil { - return nil, false + if o == nil || IsNil(o.UpstreamParameters) { + return map[string]interface{}{}, false } return o.UpstreamParameters, true } // HasUpstreamParameters returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithOidcMethod) HasUpstreamParameters() bool { - if o != nil && o.UpstreamParameters != nil { + if o != nil && !IsNil(o.UpstreamParameters) { return true } @@ -234,26 +241,69 @@ func (o *UpdateSettingsFlowWithOidcMethod) SetUpstreamParameters(v map[string]in } func (o UpdateSettingsFlowWithOidcMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateSettingsFlowWithOidcMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Flow != nil { + if !IsNil(o.Flow) { toSerialize["flow"] = o.Flow } - if o.Link != nil { + if !IsNil(o.Link) { toSerialize["link"] = o.Link } - if true { - toSerialize["method"] = o.Method - } - if o.Traits != nil { + toSerialize["method"] = o.Method + if !IsNil(o.Traits) { toSerialize["traits"] = o.Traits } - if o.Unlink != nil { + if !IsNil(o.Unlink) { toSerialize["unlink"] = o.Unlink } - if o.UpstreamParameters != nil { + if !IsNil(o.UpstreamParameters) { toSerialize["upstream_parameters"] = o.UpstreamParameters } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateSettingsFlowWithOidcMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateSettingsFlowWithOidcMethod := _UpdateSettingsFlowWithOidcMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateSettingsFlowWithOidcMethod) + + if err != nil { + return err + } + + *o = UpdateSettingsFlowWithOidcMethod(varUpdateSettingsFlowWithOidcMethod) + + return err } type NullableUpdateSettingsFlowWithOidcMethod struct { diff --git a/internal/httpclient/model_update_settings_flow_with_password_method.go b/internal/httpclient/model_update_settings_flow_with_password_method.go index d4b9934756f0..83dadeac2e70 100644 --- a/internal/httpclient/model_update_settings_flow_with_password_method.go +++ b/internal/httpclient/model_update_settings_flow_with_password_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateSettingsFlowWithPasswordMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSettingsFlowWithPasswordMethod{} + // UpdateSettingsFlowWithPasswordMethod Update Settings Flow with Password Method type UpdateSettingsFlowWithPasswordMethod struct { // CSRFToken is the anti-CSRF token @@ -25,6 +30,8 @@ type UpdateSettingsFlowWithPasswordMethod struct { Password string `json:"password"` } +type _UpdateSettingsFlowWithPasswordMethod UpdateSettingsFlowWithPasswordMethod + // NewUpdateSettingsFlowWithPasswordMethod instantiates a new UpdateSettingsFlowWithPasswordMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -46,7 +53,7 @@ func NewUpdateSettingsFlowWithPasswordMethodWithDefaults() *UpdateSettingsFlowWi // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithPasswordMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -56,7 +63,7 @@ func (o *UpdateSettingsFlowWithPasswordMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithPasswordMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -64,7 +71,7 @@ func (o *UpdateSettingsFlowWithPasswordMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithPasswordMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -125,17 +132,59 @@ func (o *UpdateSettingsFlowWithPasswordMethod) SetPassword(v string) { } func (o UpdateSettingsFlowWithPasswordMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateSettingsFlowWithPasswordMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + toSerialize["password"] = o.Password + return toSerialize, nil +} + +func (o *UpdateSettingsFlowWithPasswordMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "password", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["password"] = o.Password + + varUpdateSettingsFlowWithPasswordMethod := _UpdateSettingsFlowWithPasswordMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateSettingsFlowWithPasswordMethod) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UpdateSettingsFlowWithPasswordMethod(varUpdateSettingsFlowWithPasswordMethod) + + return err } type NullableUpdateSettingsFlowWithPasswordMethod struct { diff --git a/internal/httpclient/model_update_settings_flow_with_profile_method.go b/internal/httpclient/model_update_settings_flow_with_profile_method.go index af2051f6c38c..b98d5b8a85f9 100644 --- a/internal/httpclient/model_update_settings_flow_with_profile_method.go +++ b/internal/httpclient/model_update_settings_flow_with_profile_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateSettingsFlowWithProfileMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSettingsFlowWithProfileMethod{} + // UpdateSettingsFlowWithProfileMethod Update Settings Flow with Profile Method type UpdateSettingsFlowWithProfileMethod struct { // The Anti-CSRF Token This token is only required when performing browser flows. @@ -25,6 +30,8 @@ type UpdateSettingsFlowWithProfileMethod struct { Traits map[string]interface{} `json:"traits"` } +type _UpdateSettingsFlowWithProfileMethod UpdateSettingsFlowWithProfileMethod + // NewUpdateSettingsFlowWithProfileMethod instantiates a new UpdateSettingsFlowWithProfileMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -46,7 +53,7 @@ func NewUpdateSettingsFlowWithProfileMethodWithDefaults() *UpdateSettingsFlowWit // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithProfileMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -56,7 +63,7 @@ func (o *UpdateSettingsFlowWithProfileMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithProfileMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -64,7 +71,7 @@ func (o *UpdateSettingsFlowWithProfileMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithProfileMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -114,7 +121,7 @@ func (o *UpdateSettingsFlowWithProfileMethod) GetTraits() map[string]interface{} // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithProfileMethod) GetTraitsOk() (map[string]interface{}, bool) { if o == nil { - return nil, false + return map[string]interface{}{}, false } return o.Traits, true } @@ -125,17 +132,59 @@ func (o *UpdateSettingsFlowWithProfileMethod) SetTraits(v map[string]interface{} } func (o UpdateSettingsFlowWithProfileMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateSettingsFlowWithProfileMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + toSerialize["traits"] = o.Traits + return toSerialize, nil +} + +func (o *UpdateSettingsFlowWithProfileMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "traits", } - if true { - toSerialize["traits"] = o.Traits + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateSettingsFlowWithProfileMethod := _UpdateSettingsFlowWithProfileMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateSettingsFlowWithProfileMethod) + + if err != nil { + return err + } + + *o = UpdateSettingsFlowWithProfileMethod(varUpdateSettingsFlowWithProfileMethod) + + return err } type NullableUpdateSettingsFlowWithProfileMethod struct { diff --git a/internal/httpclient/model_update_settings_flow_with_totp_method.go b/internal/httpclient/model_update_settings_flow_with_totp_method.go index 565f5d0e8a83..303b551af996 100644 --- a/internal/httpclient/model_update_settings_flow_with_totp_method.go +++ b/internal/httpclient/model_update_settings_flow_with_totp_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateSettingsFlowWithTotpMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSettingsFlowWithTotpMethod{} + // UpdateSettingsFlowWithTotpMethod Update Settings Flow with TOTP Method type UpdateSettingsFlowWithTotpMethod struct { // CSRFToken is the anti-CSRF token @@ -27,6 +32,8 @@ type UpdateSettingsFlowWithTotpMethod struct { TotpUnlink *bool `json:"totp_unlink,omitempty"` } +type _UpdateSettingsFlowWithTotpMethod UpdateSettingsFlowWithTotpMethod + // NewUpdateSettingsFlowWithTotpMethod instantiates a new UpdateSettingsFlowWithTotpMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -47,7 +54,7 @@ func NewUpdateSettingsFlowWithTotpMethodWithDefaults() *UpdateSettingsFlowWithTo // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithTotpMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -57,7 +64,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithTotpMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -65,7 +72,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) GetCsrfTokenOk() (*string, bool) { // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithTotpMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -103,7 +110,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) SetMethod(v string) { // GetTotpCode returns the TotpCode field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithTotpMethod) GetTotpCode() string { - if o == nil || o.TotpCode == nil { + if o == nil || IsNil(o.TotpCode) { var ret string return ret } @@ -113,7 +120,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) GetTotpCode() string { // GetTotpCodeOk returns a tuple with the TotpCode field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithTotpMethod) GetTotpCodeOk() (*string, bool) { - if o == nil || o.TotpCode == nil { + if o == nil || IsNil(o.TotpCode) { return nil, false } return o.TotpCode, true @@ -121,7 +128,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) GetTotpCodeOk() (*string, bool) { // HasTotpCode returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithTotpMethod) HasTotpCode() bool { - if o != nil && o.TotpCode != nil { + if o != nil && !IsNil(o.TotpCode) { return true } @@ -135,7 +142,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) SetTotpCode(v string) { // GetTotpUnlink returns the TotpUnlink field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithTotpMethod) GetTotpUnlink() bool { - if o == nil || o.TotpUnlink == nil { + if o == nil || IsNil(o.TotpUnlink) { var ret bool return ret } @@ -145,7 +152,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) GetTotpUnlink() bool { // GetTotpUnlinkOk returns a tuple with the TotpUnlink field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithTotpMethod) GetTotpUnlinkOk() (*bool, bool) { - if o == nil || o.TotpUnlink == nil { + if o == nil || IsNil(o.TotpUnlink) { return nil, false } return o.TotpUnlink, true @@ -153,7 +160,7 @@ func (o *UpdateSettingsFlowWithTotpMethod) GetTotpUnlinkOk() (*bool, bool) { // HasTotpUnlink returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithTotpMethod) HasTotpUnlink() bool { - if o != nil && o.TotpUnlink != nil { + if o != nil && !IsNil(o.TotpUnlink) { return true } @@ -166,20 +173,63 @@ func (o *UpdateSettingsFlowWithTotpMethod) SetTotpUnlink(v bool) { } func (o UpdateSettingsFlowWithTotpMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateSettingsFlowWithTotpMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method - } - if o.TotpCode != nil { + toSerialize["method"] = o.Method + if !IsNil(o.TotpCode) { toSerialize["totp_code"] = o.TotpCode } - if o.TotpUnlink != nil { + if !IsNil(o.TotpUnlink) { toSerialize["totp_unlink"] = o.TotpUnlink } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateSettingsFlowWithTotpMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateSettingsFlowWithTotpMethod := _UpdateSettingsFlowWithTotpMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateSettingsFlowWithTotpMethod) + + if err != nil { + return err + } + + *o = UpdateSettingsFlowWithTotpMethod(varUpdateSettingsFlowWithTotpMethod) + + return err } type NullableUpdateSettingsFlowWithTotpMethod struct { diff --git a/internal/httpclient/model_update_settings_flow_with_web_authn_method.go b/internal/httpclient/model_update_settings_flow_with_web_authn_method.go index 7bcd90c82e58..45bab10538a8 100644 --- a/internal/httpclient/model_update_settings_flow_with_web_authn_method.go +++ b/internal/httpclient/model_update_settings_flow_with_web_authn_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateSettingsFlowWithWebAuthnMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSettingsFlowWithWebAuthnMethod{} + // UpdateSettingsFlowWithWebAuthnMethod Update Settings Flow with WebAuthn Method type UpdateSettingsFlowWithWebAuthnMethod struct { // CSRFToken is the anti-CSRF token @@ -29,6 +34,8 @@ type UpdateSettingsFlowWithWebAuthnMethod struct { WebauthnRemove *string `json:"webauthn_remove,omitempty"` } +type _UpdateSettingsFlowWithWebAuthnMethod UpdateSettingsFlowWithWebAuthnMethod + // NewUpdateSettingsFlowWithWebAuthnMethod instantiates a new UpdateSettingsFlowWithWebAuthnMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -49,7 +56,7 @@ func NewUpdateSettingsFlowWithWebAuthnMethodWithDefaults() *UpdateSettingsFlowWi // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -59,7 +66,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -67,7 +74,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -105,7 +112,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) SetMethod(v string) { // GetWebauthnRegister returns the WebauthnRegister field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegister() string { - if o == nil || o.WebauthnRegister == nil { + if o == nil || IsNil(o.WebauthnRegister) { var ret string return ret } @@ -115,7 +122,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegister() string { // GetWebauthnRegisterOk returns a tuple with the WebauthnRegister field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegisterOk() (*string, bool) { - if o == nil || o.WebauthnRegister == nil { + if o == nil || IsNil(o.WebauthnRegister) { return nil, false } return o.WebauthnRegister, true @@ -123,7 +130,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegisterOk() (*string, // HasWebauthnRegister returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) HasWebauthnRegister() bool { - if o != nil && o.WebauthnRegister != nil { + if o != nil && !IsNil(o.WebauthnRegister) { return true } @@ -137,7 +144,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) SetWebauthnRegister(v string) { // GetWebauthnRegisterDisplayname returns the WebauthnRegisterDisplayname field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegisterDisplayname() string { - if o == nil || o.WebauthnRegisterDisplayname == nil { + if o == nil || IsNil(o.WebauthnRegisterDisplayname) { var ret string return ret } @@ -147,7 +154,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegisterDisplayname() // GetWebauthnRegisterDisplaynameOk returns a tuple with the WebauthnRegisterDisplayname field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegisterDisplaynameOk() (*string, bool) { - if o == nil || o.WebauthnRegisterDisplayname == nil { + if o == nil || IsNil(o.WebauthnRegisterDisplayname) { return nil, false } return o.WebauthnRegisterDisplayname, true @@ -155,7 +162,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRegisterDisplaynameOk( // HasWebauthnRegisterDisplayname returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) HasWebauthnRegisterDisplayname() bool { - if o != nil && o.WebauthnRegisterDisplayname != nil { + if o != nil && !IsNil(o.WebauthnRegisterDisplayname) { return true } @@ -169,7 +176,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) SetWebauthnRegisterDisplayname(v // GetWebauthnRemove returns the WebauthnRemove field value if set, zero value otherwise. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRemove() string { - if o == nil || o.WebauthnRemove == nil { + if o == nil || IsNil(o.WebauthnRemove) { var ret string return ret } @@ -179,7 +186,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRemove() string { // GetWebauthnRemoveOk returns a tuple with the WebauthnRemove field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRemoveOk() (*string, bool) { - if o == nil || o.WebauthnRemove == nil { + if o == nil || IsNil(o.WebauthnRemove) { return nil, false } return o.WebauthnRemove, true @@ -187,7 +194,7 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) GetWebauthnRemoveOk() (*string, b // HasWebauthnRemove returns a boolean if a field has been set. func (o *UpdateSettingsFlowWithWebAuthnMethod) HasWebauthnRemove() bool { - if o != nil && o.WebauthnRemove != nil { + if o != nil && !IsNil(o.WebauthnRemove) { return true } @@ -200,23 +207,66 @@ func (o *UpdateSettingsFlowWithWebAuthnMethod) SetWebauthnRemove(v string) { } func (o UpdateSettingsFlowWithWebAuthnMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateSettingsFlowWithWebAuthnMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["method"] = o.Method - } - if o.WebauthnRegister != nil { + toSerialize["method"] = o.Method + if !IsNil(o.WebauthnRegister) { toSerialize["webauthn_register"] = o.WebauthnRegister } - if o.WebauthnRegisterDisplayname != nil { + if !IsNil(o.WebauthnRegisterDisplayname) { toSerialize["webauthn_register_displayname"] = o.WebauthnRegisterDisplayname } - if o.WebauthnRemove != nil { + if !IsNil(o.WebauthnRemove) { toSerialize["webauthn_remove"] = o.WebauthnRemove } - return json.Marshal(toSerialize) + return toSerialize, nil +} + +func (o *UpdateSettingsFlowWithWebAuthnMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateSettingsFlowWithWebAuthnMethod := _UpdateSettingsFlowWithWebAuthnMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateSettingsFlowWithWebAuthnMethod) + + if err != nil { + return err + } + + *o = UpdateSettingsFlowWithWebAuthnMethod(varUpdateSettingsFlowWithWebAuthnMethod) + + return err } type NullableUpdateSettingsFlowWithWebAuthnMethod struct { diff --git a/internal/httpclient/model_update_verification_flow_body.go b/internal/httpclient/model_update_verification_flow_body.go index f4e995d222c3..d587dc6a718e 100644 --- a/internal/httpclient/model_update_verification_flow_body.go +++ b/internal/httpclient/model_update_verification_flow_body.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -71,11 +71,11 @@ func (dst *UpdateVerificationFlowBody) UnmarshalJSON(data []byte) error { dst.UpdateVerificationFlowWithCodeMethod = nil dst.UpdateVerificationFlowWithLinkMethod = nil - return fmt.Errorf("Data matches more than one schema in oneOf(UpdateVerificationFlowBody)") + return fmt.Errorf("data matches more than one schema in oneOf(UpdateVerificationFlowBody)") } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(UpdateVerificationFlowBody)") + return fmt.Errorf("data failed to match schemas in oneOf(UpdateVerificationFlowBody)") } } diff --git a/internal/httpclient/model_update_verification_flow_with_code_method.go b/internal/httpclient/model_update_verification_flow_with_code_method.go index 4548425684b9..0ee2976d322f 100644 --- a/internal/httpclient/model_update_verification_flow_with_code_method.go +++ b/internal/httpclient/model_update_verification_flow_with_code_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateVerificationFlowWithCodeMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateVerificationFlowWithCodeMethod{} + // UpdateVerificationFlowWithCodeMethod struct for UpdateVerificationFlowWithCodeMethod type UpdateVerificationFlowWithCodeMethod struct { // Code from the recovery email If you want to submit a code, use this field, but make sure to _not_ include the email field, as well. @@ -27,6 +32,8 @@ type UpdateVerificationFlowWithCodeMethod struct { Method string `json:"method"` } +type _UpdateVerificationFlowWithCodeMethod UpdateVerificationFlowWithCodeMethod + // NewUpdateVerificationFlowWithCodeMethod instantiates a new UpdateVerificationFlowWithCodeMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -47,7 +54,7 @@ func NewUpdateVerificationFlowWithCodeMethodWithDefaults() *UpdateVerificationFl // GetCode returns the Code field value if set, zero value otherwise. func (o *UpdateVerificationFlowWithCodeMethod) GetCode() string { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { var ret string return ret } @@ -57,7 +64,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) GetCode() string { // GetCodeOk returns a tuple with the Code field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateVerificationFlowWithCodeMethod) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { + if o == nil || IsNil(o.Code) { return nil, false } return o.Code, true @@ -65,7 +72,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) GetCodeOk() (*string, bool) { // HasCode returns a boolean if a field has been set. func (o *UpdateVerificationFlowWithCodeMethod) HasCode() bool { - if o != nil && o.Code != nil { + if o != nil && !IsNil(o.Code) { return true } @@ -79,7 +86,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) SetCode(v string) { // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateVerificationFlowWithCodeMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -89,7 +96,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateVerificationFlowWithCodeMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -97,7 +104,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateVerificationFlowWithCodeMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -111,7 +118,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) SetCsrfToken(v string) { // GetEmail returns the Email field value if set, zero value otherwise. func (o *UpdateVerificationFlowWithCodeMethod) GetEmail() string { - if o == nil || o.Email == nil { + if o == nil || IsNil(o.Email) { var ret string return ret } @@ -121,7 +128,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) GetEmail() string { // GetEmailOk returns a tuple with the Email field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateVerificationFlowWithCodeMethod) GetEmailOk() (*string, bool) { - if o == nil || o.Email == nil { + if o == nil || IsNil(o.Email) { return nil, false } return o.Email, true @@ -129,7 +136,7 @@ func (o *UpdateVerificationFlowWithCodeMethod) GetEmailOk() (*string, bool) { // HasEmail returns a boolean if a field has been set. func (o *UpdateVerificationFlowWithCodeMethod) HasEmail() bool { - if o != nil && o.Email != nil { + if o != nil && !IsNil(o.Email) { return true } @@ -166,20 +173,63 @@ func (o *UpdateVerificationFlowWithCodeMethod) SetMethod(v string) { } func (o UpdateVerificationFlowWithCodeMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateVerificationFlowWithCodeMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Code != nil { + if !IsNil(o.Code) { toSerialize["code"] = o.Code } - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if o.Email != nil { + if !IsNil(o.Email) { toSerialize["email"] = o.Email } - if true { - toSerialize["method"] = o.Method + toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateVerificationFlowWithCodeMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", } - return json.Marshal(toSerialize) + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateVerificationFlowWithCodeMethod := _UpdateVerificationFlowWithCodeMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateVerificationFlowWithCodeMethod) + + if err != nil { + return err + } + + *o = UpdateVerificationFlowWithCodeMethod(varUpdateVerificationFlowWithCodeMethod) + + return err } type NullableUpdateVerificationFlowWithCodeMethod struct { diff --git a/internal/httpclient/model_update_verification_flow_with_link_method.go b/internal/httpclient/model_update_verification_flow_with_link_method.go index 8ebbbd749952..c644218676b7 100644 --- a/internal/httpclient/model_update_verification_flow_with_link_method.go +++ b/internal/httpclient/model_update_verification_flow_with_link_method.go @@ -1,20 +1,25 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" ) +// checks if the UpdateVerificationFlowWithLinkMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateVerificationFlowWithLinkMethod{} + // UpdateVerificationFlowWithLinkMethod Update Verification Flow with Link Method type UpdateVerificationFlowWithLinkMethod struct { // Sending the anti-csrf token is only required for browser login flows. @@ -25,6 +30,8 @@ type UpdateVerificationFlowWithLinkMethod struct { Method string `json:"method"` } +type _UpdateVerificationFlowWithLinkMethod UpdateVerificationFlowWithLinkMethod + // NewUpdateVerificationFlowWithLinkMethod instantiates a new UpdateVerificationFlowWithLinkMethod object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -46,7 +53,7 @@ func NewUpdateVerificationFlowWithLinkMethodWithDefaults() *UpdateVerificationFl // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateVerificationFlowWithLinkMethod) GetCsrfToken() string { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { var ret string return ret } @@ -56,7 +63,7 @@ func (o *UpdateVerificationFlowWithLinkMethod) GetCsrfToken() string { // GetCsrfTokenOk returns a tuple with the CsrfToken field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateVerificationFlowWithLinkMethod) GetCsrfTokenOk() (*string, bool) { - if o == nil || o.CsrfToken == nil { + if o == nil || IsNil(o.CsrfToken) { return nil, false } return o.CsrfToken, true @@ -64,7 +71,7 @@ func (o *UpdateVerificationFlowWithLinkMethod) GetCsrfTokenOk() (*string, bool) // HasCsrfToken returns a boolean if a field has been set. func (o *UpdateVerificationFlowWithLinkMethod) HasCsrfToken() bool { - if o != nil && o.CsrfToken != nil { + if o != nil && !IsNil(o.CsrfToken) { return true } @@ -125,17 +132,59 @@ func (o *UpdateVerificationFlowWithLinkMethod) SetMethod(v string) { } func (o UpdateVerificationFlowWithLinkMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateVerificationFlowWithLinkMethod) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CsrfToken != nil { + if !IsNil(o.CsrfToken) { toSerialize["csrf_token"] = o.CsrfToken } - if true { - toSerialize["email"] = o.Email + toSerialize["email"] = o.Email + toSerialize["method"] = o.Method + return toSerialize, nil +} + +func (o *UpdateVerificationFlowWithLinkMethod) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "email", + "method", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - if true { - toSerialize["method"] = o.Method + + varUpdateVerificationFlowWithLinkMethod := _UpdateVerificationFlowWithLinkMethod{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateVerificationFlowWithLinkMethod) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + *o = UpdateVerificationFlowWithLinkMethod(varUpdateVerificationFlowWithLinkMethod) + + return err } type NullableUpdateVerificationFlowWithLinkMethod struct { diff --git a/internal/httpclient/model_verifiable_identity_address.go b/internal/httpclient/model_verifiable_identity_address.go index 820881b2d3a2..a4e877b1399d 100644 --- a/internal/httpclient/model_verifiable_identity_address.go +++ b/internal/httpclient/model_verifiable_identity_address.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the VerifiableIdentityAddress type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VerifiableIdentityAddress{} + // VerifiableIdentityAddress VerifiableAddress is an identity's verifiable address type VerifiableIdentityAddress struct { // When this entry was created @@ -35,6 +40,8 @@ type VerifiableIdentityAddress struct { Via string `json:"via"` } +type _VerifiableIdentityAddress VerifiableIdentityAddress + // NewVerifiableIdentityAddress instantiates a new VerifiableIdentityAddress object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -58,7 +65,7 @@ func NewVerifiableIdentityAddressWithDefaults() *VerifiableIdentityAddress { // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *VerifiableIdentityAddress) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } @@ -68,7 +75,7 @@ func (o *VerifiableIdentityAddress) GetCreatedAt() time.Time { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerifiableIdentityAddress) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true @@ -76,7 +83,7 @@ func (o *VerifiableIdentityAddress) GetCreatedAtOk() (*time.Time, bool) { // HasCreatedAt returns a boolean if a field has been set. func (o *VerifiableIdentityAddress) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { + if o != nil && !IsNil(o.CreatedAt) { return true } @@ -90,7 +97,7 @@ func (o *VerifiableIdentityAddress) SetCreatedAt(v time.Time) { // GetId returns the Id field value if set, zero value otherwise. func (o *VerifiableIdentityAddress) GetId() string { - if o == nil || o.Id == nil { + if o == nil || IsNil(o.Id) { var ret string return ret } @@ -100,7 +107,7 @@ func (o *VerifiableIdentityAddress) GetId() string { // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerifiableIdentityAddress) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { + if o == nil || IsNil(o.Id) { return nil, false } return o.Id, true @@ -108,7 +115,7 @@ func (o *VerifiableIdentityAddress) GetIdOk() (*string, bool) { // HasId returns a boolean if a field has been set. func (o *VerifiableIdentityAddress) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } @@ -146,7 +153,7 @@ func (o *VerifiableIdentityAddress) SetStatus(v string) { // GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. func (o *VerifiableIdentityAddress) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { var ret time.Time return ret } @@ -156,7 +163,7 @@ func (o *VerifiableIdentityAddress) GetUpdatedAt() time.Time { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerifiableIdentityAddress) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil || IsNil(o.UpdatedAt) { return nil, false } return o.UpdatedAt, true @@ -164,7 +171,7 @@ func (o *VerifiableIdentityAddress) GetUpdatedAtOk() (*time.Time, bool) { // HasUpdatedAt returns a boolean if a field has been set. func (o *VerifiableIdentityAddress) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { + if o != nil && !IsNil(o.UpdatedAt) { return true } @@ -226,7 +233,7 @@ func (o *VerifiableIdentityAddress) SetVerified(v bool) { // GetVerifiedAt returns the VerifiedAt field value if set, zero value otherwise. func (o *VerifiableIdentityAddress) GetVerifiedAt() time.Time { - if o == nil || o.VerifiedAt == nil { + if o == nil || IsNil(o.VerifiedAt) { var ret time.Time return ret } @@ -236,7 +243,7 @@ func (o *VerifiableIdentityAddress) GetVerifiedAt() time.Time { // GetVerifiedAtOk returns a tuple with the VerifiedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerifiableIdentityAddress) GetVerifiedAtOk() (*time.Time, bool) { - if o == nil || o.VerifiedAt == nil { + if o == nil || IsNil(o.VerifiedAt) { return nil, false } return o.VerifiedAt, true @@ -244,7 +251,7 @@ func (o *VerifiableIdentityAddress) GetVerifiedAtOk() (*time.Time, bool) { // HasVerifiedAt returns a boolean if a field has been set. func (o *VerifiableIdentityAddress) HasVerifiedAt() bool { - if o != nil && o.VerifiedAt != nil { + if o != nil && !IsNil(o.VerifiedAt) { return true } @@ -281,32 +288,72 @@ func (o *VerifiableIdentityAddress) SetVia(v string) { } func (o VerifiableIdentityAddress) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VerifiableIdentityAddress) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CreatedAt != nil { + if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - if true { - toSerialize["status"] = o.Status - } - if o.UpdatedAt != nil { + toSerialize["status"] = o.Status + if !IsNil(o.UpdatedAt) { toSerialize["updated_at"] = o.UpdatedAt } - if true { - toSerialize["value"] = o.Value + toSerialize["value"] = o.Value + toSerialize["verified"] = o.Verified + if !IsNil(o.VerifiedAt) { + toSerialize["verified_at"] = o.VerifiedAt } - if true { - toSerialize["verified"] = o.Verified + toSerialize["via"] = o.Via + return toSerialize, nil +} + +func (o *VerifiableIdentityAddress) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "status", + "value", + "verified", + "via", } - if o.VerifiedAt != nil { - toSerialize["verified_at"] = o.VerifiedAt + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - if true { - toSerialize["via"] = o.Via + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } } - return json.Marshal(toSerialize) + + varVerifiableIdentityAddress := _VerifiableIdentityAddress{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varVerifiableIdentityAddress) + + if err != nil { + return err + } + + *o = VerifiableIdentityAddress(varVerifiableIdentityAddress) + + return err } type NullableVerifiableIdentityAddress struct { diff --git a/internal/httpclient/model_verification_flow.go b/internal/httpclient/model_verification_flow.go index c10870c9f841..5655b1916544 100644 --- a/internal/httpclient/model_verification_flow.go +++ b/internal/httpclient/model_verification_flow.go @@ -1,21 +1,26 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( + "bytes" "encoding/json" + "fmt" "time" ) +// checks if the VerificationFlow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VerificationFlow{} + // VerificationFlow Used to verify an out-of-band communication channel such as an email address or a phone number. For more information head over to: https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation type VerificationFlow struct { // Active, if set, contains the registration method that is being used. It is initially not set. @@ -37,6 +42,8 @@ type VerificationFlow struct { Ui UiContainer `json:"ui"` } +type _VerificationFlow VerificationFlow + // NewVerificationFlow instantiates a new VerificationFlow object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -60,7 +67,7 @@ func NewVerificationFlowWithDefaults() *VerificationFlow { // GetActive returns the Active field value if set, zero value otherwise. func (o *VerificationFlow) GetActive() string { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { var ret string return ret } @@ -70,7 +77,7 @@ func (o *VerificationFlow) GetActive() string { // GetActiveOk returns a tuple with the Active field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerificationFlow) GetActiveOk() (*string, bool) { - if o == nil || o.Active == nil { + if o == nil || IsNil(o.Active) { return nil, false } return o.Active, true @@ -78,7 +85,7 @@ func (o *VerificationFlow) GetActiveOk() (*string, bool) { // HasActive returns a boolean if a field has been set. func (o *VerificationFlow) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } @@ -92,7 +99,7 @@ func (o *VerificationFlow) SetActive(v string) { // GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. func (o *VerificationFlow) GetExpiresAt() time.Time { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { var ret time.Time return ret } @@ -102,7 +109,7 @@ func (o *VerificationFlow) GetExpiresAt() time.Time { // GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerificationFlow) GetExpiresAtOk() (*time.Time, bool) { - if o == nil || o.ExpiresAt == nil { + if o == nil || IsNil(o.ExpiresAt) { return nil, false } return o.ExpiresAt, true @@ -110,7 +117,7 @@ func (o *VerificationFlow) GetExpiresAtOk() (*time.Time, bool) { // HasExpiresAt returns a boolean if a field has been set. func (o *VerificationFlow) HasExpiresAt() bool { - if o != nil && o.ExpiresAt != nil { + if o != nil && !IsNil(o.ExpiresAt) { return true } @@ -148,7 +155,7 @@ func (o *VerificationFlow) SetId(v string) { // GetIssuedAt returns the IssuedAt field value if set, zero value otherwise. func (o *VerificationFlow) GetIssuedAt() time.Time { - if o == nil || o.IssuedAt == nil { + if o == nil || IsNil(o.IssuedAt) { var ret time.Time return ret } @@ -158,7 +165,7 @@ func (o *VerificationFlow) GetIssuedAt() time.Time { // GetIssuedAtOk returns a tuple with the IssuedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerificationFlow) GetIssuedAtOk() (*time.Time, bool) { - if o == nil || o.IssuedAt == nil { + if o == nil || IsNil(o.IssuedAt) { return nil, false } return o.IssuedAt, true @@ -166,7 +173,7 @@ func (o *VerificationFlow) GetIssuedAtOk() (*time.Time, bool) { // HasIssuedAt returns a boolean if a field has been set. func (o *VerificationFlow) HasIssuedAt() bool { - if o != nil && o.IssuedAt != nil { + if o != nil && !IsNil(o.IssuedAt) { return true } @@ -180,7 +187,7 @@ func (o *VerificationFlow) SetIssuedAt(v time.Time) { // GetRequestUrl returns the RequestUrl field value if set, zero value otherwise. func (o *VerificationFlow) GetRequestUrl() string { - if o == nil || o.RequestUrl == nil { + if o == nil || IsNil(o.RequestUrl) { var ret string return ret } @@ -190,7 +197,7 @@ func (o *VerificationFlow) GetRequestUrl() string { // GetRequestUrlOk returns a tuple with the RequestUrl field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerificationFlow) GetRequestUrlOk() (*string, bool) { - if o == nil || o.RequestUrl == nil { + if o == nil || IsNil(o.RequestUrl) { return nil, false } return o.RequestUrl, true @@ -198,7 +205,7 @@ func (o *VerificationFlow) GetRequestUrlOk() (*string, bool) { // HasRequestUrl returns a boolean if a field has been set. func (o *VerificationFlow) HasRequestUrl() bool { - if o != nil && o.RequestUrl != nil { + if o != nil && !IsNil(o.RequestUrl) { return true } @@ -212,7 +219,7 @@ func (o *VerificationFlow) SetRequestUrl(v string) { // GetReturnTo returns the ReturnTo field value if set, zero value otherwise. func (o *VerificationFlow) GetReturnTo() string { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { var ret string return ret } @@ -222,7 +229,7 @@ func (o *VerificationFlow) GetReturnTo() string { // GetReturnToOk returns a tuple with the ReturnTo field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *VerificationFlow) GetReturnToOk() (*string, bool) { - if o == nil || o.ReturnTo == nil { + if o == nil || IsNil(o.ReturnTo) { return nil, false } return o.ReturnTo, true @@ -230,7 +237,7 @@ func (o *VerificationFlow) GetReturnToOk() (*string, bool) { // HasReturnTo returns a boolean if a field has been set. func (o *VerificationFlow) HasReturnTo() bool { - if o != nil && o.ReturnTo != nil { + if o != nil && !IsNil(o.ReturnTo) { return true } @@ -257,7 +264,7 @@ func (o *VerificationFlow) GetState() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *VerificationFlow) GetStateOk() (*interface{}, bool) { - if o == nil || o.State == nil { + if o == nil || IsNil(o.State) { return nil, false } return &o.State, true @@ -317,35 +324,77 @@ func (o *VerificationFlow) SetUi(v UiContainer) { } func (o VerificationFlow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VerificationFlow) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - if o.ExpiresAt != nil { + if !IsNil(o.ExpiresAt) { toSerialize["expires_at"] = o.ExpiresAt } - if true { - toSerialize["id"] = o.Id - } - if o.IssuedAt != nil { + toSerialize["id"] = o.Id + if !IsNil(o.IssuedAt) { toSerialize["issued_at"] = o.IssuedAt } - if o.RequestUrl != nil { + if !IsNil(o.RequestUrl) { toSerialize["request_url"] = o.RequestUrl } - if o.ReturnTo != nil { + if !IsNil(o.ReturnTo) { toSerialize["return_to"] = o.ReturnTo } if o.State != nil { toSerialize["state"] = o.State } - if true { - toSerialize["type"] = o.Type + toSerialize["type"] = o.Type + toSerialize["ui"] = o.Ui + return toSerialize, nil +} + +func (o *VerificationFlow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "state", + "type", + "ui", } - if true { - toSerialize["ui"] = o.Ui + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err } - return json.Marshal(toSerialize) + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVerificationFlow := _VerificationFlow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varVerificationFlow) + + if err != nil { + return err + } + + *o = VerificationFlow(varVerificationFlow) + + return err } type NullableVerificationFlow struct { diff --git a/internal/httpclient/model_verification_flow_state.go b/internal/httpclient/model_verification_flow_state.go index bea74568c94d..904585ab0edc 100644 --- a/internal/httpclient/model_verification_flow_state.go +++ b/internal/httpclient/model_verification_flow_state.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -26,6 +26,13 @@ const ( VERIFICATIONFLOWSTATE_PASSED_CHALLENGE VerificationFlowState = "passed_challenge" ) +// All allowed values of VerificationFlowState enum +var AllowedVerificationFlowStateEnumValues = []VerificationFlowState{ + "choose_method", + "sent_email", + "passed_challenge", +} + func (v *VerificationFlowState) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) @@ -33,7 +40,7 @@ func (v *VerificationFlowState) UnmarshalJSON(src []byte) error { return err } enumTypeValue := VerificationFlowState(value) - for _, existing := range []VerificationFlowState{"choose_method", "sent_email", "passed_challenge"} { + for _, existing := range AllowedVerificationFlowStateEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil @@ -43,6 +50,27 @@ func (v *VerificationFlowState) UnmarshalJSON(src []byte) error { return fmt.Errorf("%+v is not a valid VerificationFlowState", value) } +// NewVerificationFlowStateFromValue returns a pointer to a valid VerificationFlowState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVerificationFlowStateFromValue(v string) (*VerificationFlowState, error) { + ev := VerificationFlowState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VerificationFlowState: valid values are %v", v, AllowedVerificationFlowStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VerificationFlowState) IsValid() bool { + for _, existing := range AllowedVerificationFlowStateEnumValues { + if existing == v { + return true + } + } + return false +} + // Ptr returns reference to verificationFlowState value func (v VerificationFlowState) Ptr() *VerificationFlowState { return &v diff --git a/internal/httpclient/model_version.go b/internal/httpclient/model_version.go index 8df906ec237c..1e3beed44e37 100644 --- a/internal/httpclient/model_version.go +++ b/internal/httpclient/model_version.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,6 +15,9 @@ import ( "encoding/json" ) +// checks if the Version type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Version{} + // Version struct for Version type Version struct { // Version is the service's version. @@ -40,7 +43,7 @@ func NewVersionWithDefaults() *Version { // GetVersion returns the Version field value if set, zero value otherwise. func (o *Version) GetVersion() string { - if o == nil || o.Version == nil { + if o == nil || IsNil(o.Version) { var ret string return ret } @@ -50,7 +53,7 @@ func (o *Version) GetVersion() string { // GetVersionOk returns a tuple with the Version field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Version) GetVersionOk() (*string, bool) { - if o == nil || o.Version == nil { + if o == nil || IsNil(o.Version) { return nil, false } return o.Version, true @@ -58,7 +61,7 @@ func (o *Version) GetVersionOk() (*string, bool) { // HasVersion returns a boolean if a field has been set. func (o *Version) HasVersion() bool { - if o != nil && o.Version != nil { + if o != nil && !IsNil(o.Version) { return true } @@ -71,11 +74,19 @@ func (o *Version) SetVersion(v string) { } func (o Version) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Version) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Version != nil { + if !IsNil(o.Version) { toSerialize["version"] = o.Version } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableVersion struct { diff --git a/internal/httpclient/response.go b/internal/httpclient/response.go index 424806a6341c..50599b1354b5 100644 --- a/internal/httpclient/response.go +++ b/internal/httpclient/response.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -33,7 +33,7 @@ type APIResponse struct { Payload []byte `json:"-"` } -// NewAPIResponse returns a new APIResonse object. +// NewAPIResponse returns a new APIResponse object. func NewAPIResponse(r *http.Response) *APIResponse { response := &APIResponse{Response: r} diff --git a/internal/httpclient/utils.go b/internal/httpclient/utils.go index 3ac602a1d200..6d5271970a91 100644 --- a/internal/httpclient/utils.go +++ b/internal/httpclient/utils.go @@ -1,11 +1,11 @@ /* - * Ory Identities API - * - * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. - * - * API version: - * Contact: office@ory.sh - */ +Ory Identities API + +This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. + +API version: +Contact: office@ory.sh +*/ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -13,6 +13,7 @@ package client import ( "encoding/json" + "reflect" "time" ) @@ -327,3 +328,21 @@ func (v *NullableTime) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +}