From 68670a6a56b6a3b7240b7e3a823ed40142ad1584 Mon Sep 17 00:00:00 2001 From: Geoffrey Ragot Date: Tue, 2 Aug 2022 23:38:46 +0200 Subject: [PATCH] feat: Generate Go client --- Taskfile.yaml | 14 + main.go | 1 + pkg/client/.gitignore | 24 + pkg/client/.openapi-generator-ignore | 23 + pkg/client/.openapi-generator/FILES | 35 + pkg/client/.openapi-generator/VERSION | 1 + pkg/client/.travis.yml | 8 + pkg/client/README.md | 136 ++ pkg/client/api/openapi.yaml | 409 ++++++ pkg/client/api_default.go | 1418 ++++++++++++++++++++ pkg/client/client.go | 563 ++++++++ pkg/client/configuration.go | 236 ++++ pkg/client/docs/Client.md | 202 +++ pkg/client/docs/ClientAllOf.md | 77 ++ pkg/client/docs/ClientOptions.md | 155 +++ pkg/client/docs/CreateClientResponse.md | 56 + pkg/client/docs/CreateScopeResponse.md | 56 + pkg/client/docs/DefaultApi.md | 966 +++++++++++++ pkg/client/docs/ListClientsResponse.md | 56 + pkg/client/docs/ListScopesResponse.md | 56 + pkg/client/docs/ReadClientResponse.md | 56 + pkg/client/docs/Scope.md | 98 ++ pkg/client/docs/ScopeAllOf.md | 77 ++ pkg/client/docs/ScopeOptions.md | 51 + pkg/client/git_push.sh | 57 + pkg/client/go.mod | 7 + pkg/client/go.sum | 13 + pkg/client/model_client.go | 317 +++++ pkg/client/model_client_all_of.go | 144 ++ pkg/client/model_client_options.go | 252 ++++ pkg/client/model_create_client_response.go | 115 ++ pkg/client/model_create_scope_response.go | 115 ++ pkg/client/model_list_clients_response.go | 115 ++ pkg/client/model_list_scopes_response.go | 115 ++ pkg/client/model_read_client_response.go | 115 ++ pkg/client/model_scope.go | 173 +++ pkg/client/model_scope_all_of.go | 144 ++ pkg/client/model_scope_options.go | 108 ++ pkg/client/response.go | 47 + pkg/client/utils.go | 328 +++++ swagger.yaml | 2 + 41 files changed, 6941 insertions(+) create mode 100644 pkg/client/.gitignore create mode 100644 pkg/client/.openapi-generator-ignore create mode 100644 pkg/client/.openapi-generator/FILES create mode 100644 pkg/client/.openapi-generator/VERSION create mode 100644 pkg/client/.travis.yml create mode 100644 pkg/client/README.md create mode 100644 pkg/client/api/openapi.yaml create mode 100644 pkg/client/api_default.go create mode 100644 pkg/client/client.go create mode 100644 pkg/client/configuration.go create mode 100644 pkg/client/docs/Client.md create mode 100644 pkg/client/docs/ClientAllOf.md create mode 100644 pkg/client/docs/ClientOptions.md create mode 100644 pkg/client/docs/CreateClientResponse.md create mode 100644 pkg/client/docs/CreateScopeResponse.md create mode 100644 pkg/client/docs/DefaultApi.md create mode 100644 pkg/client/docs/ListClientsResponse.md create mode 100644 pkg/client/docs/ListScopesResponse.md create mode 100644 pkg/client/docs/ReadClientResponse.md create mode 100644 pkg/client/docs/Scope.md create mode 100644 pkg/client/docs/ScopeAllOf.md create mode 100644 pkg/client/docs/ScopeOptions.md create mode 100644 pkg/client/git_push.sh create mode 100644 pkg/client/go.mod create mode 100644 pkg/client/go.sum create mode 100644 pkg/client/model_client.go create mode 100644 pkg/client/model_client_all_of.go create mode 100644 pkg/client/model_client_options.go create mode 100644 pkg/client/model_create_client_response.go create mode 100644 pkg/client/model_create_scope_response.go create mode 100644 pkg/client/model_list_clients_response.go create mode 100644 pkg/client/model_list_scopes_response.go create mode 100644 pkg/client/model_read_client_response.go create mode 100644 pkg/client/model_scope.go create mode 100644 pkg/client/model_scope_all_of.go create mode 100644 pkg/client/model_scope_options.go create mode 100644 pkg/client/response.go create mode 100644 pkg/client/utils.go diff --git a/Taskfile.yaml b/Taskfile.yaml index 1e144c2..a5fd9da 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -19,3 +19,17 @@ tasks: - build-image cmds: - docker run --rm github.com/numary/{{.COMPONENT}} + generate-client: + - > + docker run --rm + -w /local + -v ${PWD}:/local + openapitools/openapi-generator-cli:latest generate + -i swagger.yaml + -g go + -o ./pkg/client + --git-user-id=numary + --git-repo-id=auth + -p packageVersion=latest + -p isGoSubmodule=true + -p packageName=authclient diff --git a/main.go b/main.go index eb28ab2..558867c 100644 --- a/main.go +++ b/main.go @@ -1,3 +1,4 @@ +//go:generate task generate-client package main import "github.com/numary/auth/cmd" diff --git a/pkg/client/.gitignore b/pkg/client/.gitignore new file mode 100644 index 0000000..daf913b --- /dev/null +++ b/pkg/client/.gitignore @@ -0,0 +1,24 @@ +# 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/pkg/client/.openapi-generator-ignore b/pkg/client/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/pkg/client/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/pkg/client/.openapi-generator/FILES b/pkg/client/.openapi-generator/FILES new file mode 100644 index 0000000..d397f6a --- /dev/null +++ b/pkg/client/.openapi-generator/FILES @@ -0,0 +1,35 @@ +.gitignore +.travis.yml +README.md +api/openapi.yaml +api_default.go +client.go +configuration.go +docs/Client.md +docs/ClientAllOf.md +docs/ClientOptions.md +docs/CreateClientResponse.md +docs/CreateScopeResponse.md +docs/DefaultApi.md +docs/ListClientsResponse.md +docs/ListScopesResponse.md +docs/ReadClientResponse.md +docs/Scope.md +docs/ScopeAllOf.md +docs/ScopeOptions.md +git_push.sh +go.mod +go.sum +model_client.go +model_client_all_of.go +model_client_options.go +model_create_client_response.go +model_create_scope_response.go +model_list_clients_response.go +model_list_scopes_response.go +model_read_client_response.go +model_scope.go +model_scope_all_of.go +model_scope_options.go +response.go +utils.go diff --git a/pkg/client/.openapi-generator/VERSION b/pkg/client/.openapi-generator/VERSION new file mode 100644 index 0000000..66672d4 --- /dev/null +++ b/pkg/client/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.1.0-SNAPSHOT \ No newline at end of file diff --git a/pkg/client/.travis.yml b/pkg/client/.travis.yml new file mode 100644 index 0000000..f5cb2ce --- /dev/null +++ b/pkg/client/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/pkg/client/README.md b/pkg/client/README.md new file mode 100644 index 0000000..90dd6b3 --- /dev/null +++ b/pkg/client/README.md @@ -0,0 +1,136 @@ +# Go API client for authclient + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +## 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: AUTH_VERSION +- Package version: latest +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## 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 authclient "github.com/numary/auth/authclient" +``` + +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(), authclient.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(), authclient.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 identified 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(), authclient.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), authclient.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://.o.numary.cloud/auth* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**AddScopeToClient**](docs/DefaultApi.md#addscopetoclient) | **Put** /clients/{clientId}/scopes/{scopeId} | Add scope to client +*DefaultApi* | [**AddTransientScope**](docs/DefaultApi.md#addtransientscope) | **Put** /scopes/{scopeId}/transient/{transientScopeId} | Add a transient scope to a scope +*DefaultApi* | [**CreateClient**](docs/DefaultApi.md#createclient) | **Post** /clients | Create client +*DefaultApi* | [**CreateScope**](docs/DefaultApi.md#createscope) | **Post** /scopes | Create scope +*DefaultApi* | [**DeleteClient**](docs/DefaultApi.md#deleteclient) | **Delete** /clients/{clientId} | Delete client +*DefaultApi* | [**DeleteScope**](docs/DefaultApi.md#deletescope) | **Delete** /scopes/{scopeId} | Delete scope +*DefaultApi* | [**DeleteScopeFromClient**](docs/DefaultApi.md#deletescopefromclient) | **Delete** /clients/{clientId}/scopes/{scopeId} | Delete scope from client +*DefaultApi* | [**DeleteTransientScope**](docs/DefaultApi.md#deletetransientscope) | **Delete** /scopes/{scopeId}/transient/{transientScopeId} | Delete a transient scope from a scope +*DefaultApi* | [**ListClients**](docs/DefaultApi.md#listclients) | **Get** /clients | List clients +*DefaultApi* | [**ListScopes**](docs/DefaultApi.md#listscopes) | **Get** /scopes | List scopes +*DefaultApi* | [**ReadClient**](docs/DefaultApi.md#readclient) | **Get** /clients/{clientId} | Read client +*DefaultApi* | [**ReadScope**](docs/DefaultApi.md#readscope) | **Get** /scopes/{scopeId} | Read scope +*DefaultApi* | [**UpdateClient**](docs/DefaultApi.md#updateclient) | **Put** /clients/{clientId} | Update client +*DefaultApi* | [**UpdateScope**](docs/DefaultApi.md#updatescope) | **Put** /scopes/{scopeId} | Update scope + + +## Documentation For Models + + - [Client](docs/Client.md) + - [ClientAllOf](docs/ClientAllOf.md) + - [ClientOptions](docs/ClientOptions.md) + - [CreateClientResponse](docs/CreateClientResponse.md) + - [CreateScopeResponse](docs/CreateScopeResponse.md) + - [ListClientsResponse](docs/ListClientsResponse.md) + - [ListScopesResponse](docs/ListScopesResponse.md) + - [ReadClientResponse](docs/ReadClientResponse.md) + - [Scope](docs/Scope.md) + - [ScopeAllOf](docs/ScopeAllOf.md) + - [ScopeOptions](docs/ScopeOptions.md) + + +## Documentation For Authorization + + Endpoints do not require authorization. + + +## 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 + + + diff --git a/pkg/client/api/openapi.yaml b/pkg/client/api/openapi.yaml new file mode 100644 index 0000000..3593259 --- /dev/null +++ b/pkg/client/api/openapi.yaml @@ -0,0 +1,409 @@ +openapi: 3.0.3 +info: + contact: {} + title: Auth API + version: AUTH_VERSION +servers: +- description: Production server + url: "https://{organization}.o.numary.cloud/auth" + variables: + organization: + default: "" + description: The organization on which the auth server is located +paths: + /clients: + get: + operationId: listClients + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ListClientsResponse' + description: List of clients + summary: List clients + post: + operationId: createClient + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateClientRequest' + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/CreateClientResponse' + description: Client created + summary: Create client + /clients/{clientId}: + delete: + operationId: deleteClient + parameters: + - description: Client ID + explode: false + in: path + name: clientId + required: true + schema: + type: string + style: simple + responses: + "204": + description: Client deleted + summary: Delete client + get: + operationId: readClient + parameters: + - description: Client ID + explode: false + in: path + name: clientId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ReadClientResponse' + description: Retrieved client + summary: Read client + put: + operationId: updateClient + parameters: + - description: Client ID + explode: false + in: path + name: clientId + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateClientRequest' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateClientResponse' + description: Updated client + summary: Update client + /clients/{clientId}/scopes/{scopeId}: + delete: + operationId: deleteScopeFromClient + parameters: + - description: Client ID + explode: false + in: path + name: clientId + required: true + schema: + type: string + style: simple + - description: Scope ID + explode: false + in: path + name: scopeId + required: true + schema: + type: string + style: simple + responses: + "204": + description: Scope deleted from client + summary: Delete scope from client + put: + operationId: addScopeToClient + parameters: + - description: Client ID + explode: false + in: path + name: clientId + required: true + schema: + type: string + style: simple + - description: Scope ID + explode: false + in: path + name: scopeId + required: true + schema: + type: string + style: simple + responses: + "204": + description: Scope added to client + summary: Add scope to client + /scopes: + get: + description: List Scopes + operationId: listScopes + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ListScopesResponse' + description: List of scopes + summary: List scopes + post: + description: Create scope + operationId: createScope + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateScopeRequest' + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/CreateScopeResponse' + description: Created scope + summary: Create scope + /scopes/{scopeId}: + delete: + description: Delete scope + operationId: deleteScope + parameters: + - description: Scope ID + explode: false + in: path + name: scopeId + required: true + schema: + type: string + style: simple + responses: + "204": + description: Scope deleted + summary: Delete scope + get: + description: Read scope + operationId: readScope + parameters: + - description: Scope ID + explode: false + in: path + name: scopeId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ReadScopeResponse' + description: Retrieved scope + summary: Read scope + put: + description: Update scope + operationId: updateScope + parameters: + - description: Scope ID + explode: false + in: path + name: scopeId + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateScopeRequest' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateScopeResponse' + description: Updated scope + summary: Update scope + /scopes/{scopeId}/transient/{transientScopeId}: + delete: + description: Delete a transient scope from a scope + operationId: deleteTransientScope + parameters: + - description: Scope ID + explode: false + in: path + name: scopeId + required: true + schema: + type: string + style: simple + - description: Transient scope ID + explode: false + in: path + name: transientScopeId + required: true + schema: + type: string + style: simple + responses: + "204": + description: Transient scope deleted + summary: Delete a transient scope from a scope + put: + description: Add a transient scope to a scope + operationId: addTransientScope + parameters: + - description: Scope ID + explode: false + in: path + name: scopeId + required: true + schema: + type: string + style: simple + - description: Transient scope ID + explode: false + in: path + name: transientScopeId + required: true + schema: + type: string + style: simple + responses: + "204": + description: Scope added + summary: Add a transient scope to a scope +components: + schemas: + ClientOptions: + example: + public: true + postLogoutRedirectUris: + - postLogoutRedirectUris + - postLogoutRedirectUris + name: name + description: description + redirectUris: + - redirectUris + - redirectUris + properties: + public: + type: boolean + redirectUris: + items: + type: string + type: array + description: + type: string + name: + type: string + postLogoutRedirectUris: + items: + type: string + type: array + required: + - name + type: object + Client: + allOf: + - $ref: '#/components/schemas/ClientOptions' + - $ref: '#/components/schemas/Client_allOf' + ScopeOptions: + properties: + label: + type: string + required: + - label + type: object + Scope: + allOf: + - $ref: '#/components/schemas/ScopeOptions' + - $ref: '#/components/schemas/Scope_allOf' + CreateClientRequest: + $ref: '#/components/schemas/ClientOptions' + CreateClientResponse: + example: + data: null + properties: + data: + $ref: '#/components/schemas/Client' + type: object + ListClientsResponse: + example: + data: + - null + - null + properties: + data: + items: + $ref: '#/components/schemas/Client' + type: array + type: object + UpdateClientRequest: + $ref: '#/components/schemas/ClientOptions' + UpdateClientResponse: + $ref: '#/components/schemas/CreateClientResponse' + ReadClientResponse: + example: + data: null + properties: + data: + $ref: '#/components/schemas/Client' + type: object + ListScopesResponse: + example: + data: + - null + - null + properties: + data: + items: + $ref: '#/components/schemas/Scope' + type: array + type: object + CreateScopeRequest: + $ref: '#/components/schemas/ClientOptions' + CreateScopeResponse: + example: + data: null + properties: + data: + $ref: '#/components/schemas/Scope' + type: object + ReadScopeResponse: + $ref: '#/components/schemas/CreateScopeResponse' + UpdateScopeRequest: + $ref: '#/components/schemas/ClientOptions' + UpdateScopeResponse: + $ref: '#/components/schemas/CreateScopeResponse' + Client_allOf: + properties: + id: + type: string + scopes: + items: + type: string + type: array + required: + - id + type: object + Scope_allOf: + properties: + id: + type: string + transient: + items: + type: string + type: array + required: + - id + type: object diff --git a/pkg/client/api_default.go b/pkg/client/api_default.go new file mode 100644 index 0000000..f8d5016 --- /dev/null +++ b/pkg/client/api_default.go @@ -0,0 +1,1418 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type ApiAddScopeToClientRequest struct { + ctx context.Context + ApiService *DefaultApiService + clientId string + scopeId string +} + +func (r ApiAddScopeToClientRequest) Execute() (*http.Response, error) { + return r.ApiService.AddScopeToClientExecute(r) +} + +/* +AddScopeToClient Add scope to client + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clientId Client ID + @param scopeId Scope ID + @return ApiAddScopeToClientRequest +*/ +func (a *DefaultApiService) AddScopeToClient(ctx context.Context, clientId string, scopeId string) ApiAddScopeToClientRequest { + return ApiAddScopeToClientRequest{ + ApiService: a, + ctx: ctx, + clientId: clientId, + scopeId: scopeId, + } +} + +// Execute executes the request +func (a *DefaultApiService) AddScopeToClientExecute(r ApiAddScopeToClientRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddScopeToClient") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clients/{clientId}/scopes/{scopeId}" + localVarPath = strings.Replace(localVarPath, "{"+"clientId"+"}", url.PathEscape(parameterToString(r.clientId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"scopeId"+"}", url.PathEscape(parameterToString(r.scopeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiAddTransientScopeRequest struct { + ctx context.Context + ApiService *DefaultApiService + scopeId string + transientScopeId string +} + +func (r ApiAddTransientScopeRequest) Execute() (*http.Response, error) { + return r.ApiService.AddTransientScopeExecute(r) +} + +/* +AddTransientScope Add a transient scope to a scope + +Add a transient scope to a scope + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param scopeId Scope ID + @param transientScopeId Transient scope ID + @return ApiAddTransientScopeRequest +*/ +func (a *DefaultApiService) AddTransientScope(ctx context.Context, scopeId string, transientScopeId string) ApiAddTransientScopeRequest { + return ApiAddTransientScopeRequest{ + ApiService: a, + ctx: ctx, + scopeId: scopeId, + transientScopeId: transientScopeId, + } +} + +// Execute executes the request +func (a *DefaultApiService) AddTransientScopeExecute(r ApiAddTransientScopeRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddTransientScope") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/scopes/{scopeId}/transient/{transientScopeId}" + localVarPath = strings.Replace(localVarPath, "{"+"scopeId"+"}", url.PathEscape(parameterToString(r.scopeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"transientScopeId"+"}", url.PathEscape(parameterToString(r.transientScopeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiCreateClientRequest struct { + ctx context.Context + ApiService *DefaultApiService + body *ClientOptions +} + +func (r ApiCreateClientRequest) Body(body ClientOptions) ApiCreateClientRequest { + r.body = &body + return r +} + +func (r ApiCreateClientRequest) Execute() (*CreateClientResponse, *http.Response, error) { + return r.ApiService.CreateClientExecute(r) +} + +/* +CreateClient Create client + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateClientRequest +*/ +func (a *DefaultApiService) CreateClient(ctx context.Context) ApiCreateClientRequest { + return ApiCreateClientRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return CreateClientResponse +func (a *DefaultApiService) CreateClientExecute(r ApiCreateClientRequest) (*CreateClientResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateClientResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateClient") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clients" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateScopeRequest struct { + ctx context.Context + ApiService *DefaultApiService + body *ClientOptions +} + +func (r ApiCreateScopeRequest) Body(body ClientOptions) ApiCreateScopeRequest { + r.body = &body + return r +} + +func (r ApiCreateScopeRequest) Execute() (*CreateScopeResponse, *http.Response, error) { + return r.ApiService.CreateScopeExecute(r) +} + +/* +CreateScope Create scope + +Create scope + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateScopeRequest +*/ +func (a *DefaultApiService) CreateScope(ctx context.Context) ApiCreateScopeRequest { + return ApiCreateScopeRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return CreateScopeResponse +func (a *DefaultApiService) CreateScopeExecute(r ApiCreateScopeRequest) (*CreateScopeResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateScopeResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateScope") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/scopes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteClientRequest struct { + ctx context.Context + ApiService *DefaultApiService + clientId string +} + +func (r ApiDeleteClientRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteClientExecute(r) +} + +/* +DeleteClient Delete client + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clientId Client ID + @return ApiDeleteClientRequest +*/ +func (a *DefaultApiService) DeleteClient(ctx context.Context, clientId string) ApiDeleteClientRequest { + return ApiDeleteClientRequest{ + ApiService: a, + ctx: ctx, + clientId: clientId, + } +} + +// Execute executes the request +func (a *DefaultApiService) DeleteClientExecute(r ApiDeleteClientRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteClient") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clients/{clientId}" + localVarPath = strings.Replace(localVarPath, "{"+"clientId"+"}", url.PathEscape(parameterToString(r.clientId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteScopeRequest struct { + ctx context.Context + ApiService *DefaultApiService + scopeId string +} + +func (r ApiDeleteScopeRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteScopeExecute(r) +} + +/* +DeleteScope Delete scope + +Delete scope + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param scopeId Scope ID + @return ApiDeleteScopeRequest +*/ +func (a *DefaultApiService) DeleteScope(ctx context.Context, scopeId string) ApiDeleteScopeRequest { + return ApiDeleteScopeRequest{ + ApiService: a, + ctx: ctx, + scopeId: scopeId, + } +} + +// Execute executes the request +func (a *DefaultApiService) DeleteScopeExecute(r ApiDeleteScopeRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteScope") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/scopes/{scopeId}" + localVarPath = strings.Replace(localVarPath, "{"+"scopeId"+"}", url.PathEscape(parameterToString(r.scopeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteScopeFromClientRequest struct { + ctx context.Context + ApiService *DefaultApiService + clientId string + scopeId string +} + +func (r ApiDeleteScopeFromClientRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteScopeFromClientExecute(r) +} + +/* +DeleteScopeFromClient Delete scope from client + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clientId Client ID + @param scopeId Scope ID + @return ApiDeleteScopeFromClientRequest +*/ +func (a *DefaultApiService) DeleteScopeFromClient(ctx context.Context, clientId string, scopeId string) ApiDeleteScopeFromClientRequest { + return ApiDeleteScopeFromClientRequest{ + ApiService: a, + ctx: ctx, + clientId: clientId, + scopeId: scopeId, + } +} + +// Execute executes the request +func (a *DefaultApiService) DeleteScopeFromClientExecute(r ApiDeleteScopeFromClientRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteScopeFromClient") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clients/{clientId}/scopes/{scopeId}" + localVarPath = strings.Replace(localVarPath, "{"+"clientId"+"}", url.PathEscape(parameterToString(r.clientId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"scopeId"+"}", url.PathEscape(parameterToString(r.scopeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteTransientScopeRequest struct { + ctx context.Context + ApiService *DefaultApiService + scopeId string + transientScopeId string +} + +func (r ApiDeleteTransientScopeRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteTransientScopeExecute(r) +} + +/* +DeleteTransientScope Delete a transient scope from a scope + +Delete a transient scope from a scope + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param scopeId Scope ID + @param transientScopeId Transient scope ID + @return ApiDeleteTransientScopeRequest +*/ +func (a *DefaultApiService) DeleteTransientScope(ctx context.Context, scopeId string, transientScopeId string) ApiDeleteTransientScopeRequest { + return ApiDeleteTransientScopeRequest{ + ApiService: a, + ctx: ctx, + scopeId: scopeId, + transientScopeId: transientScopeId, + } +} + +// Execute executes the request +func (a *DefaultApiService) DeleteTransientScopeExecute(r ApiDeleteTransientScopeRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteTransientScope") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/scopes/{scopeId}/transient/{transientScopeId}" + localVarPath = strings.Replace(localVarPath, "{"+"scopeId"+"}", url.PathEscape(parameterToString(r.scopeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"transientScopeId"+"}", url.PathEscape(parameterToString(r.transientScopeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiListClientsRequest struct { + ctx context.Context + ApiService *DefaultApiService +} + +func (r ApiListClientsRequest) Execute() (*ListClientsResponse, *http.Response, error) { + return r.ApiService.ListClientsExecute(r) +} + +/* +ListClients List clients + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListClientsRequest +*/ +func (a *DefaultApiService) ListClients(ctx context.Context) ApiListClientsRequest { + return ApiListClientsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ListClientsResponse +func (a *DefaultApiService) ListClientsExecute(r ApiListClientsRequest) (*ListClientsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListClientsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListClients") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clients" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListScopesRequest struct { + ctx context.Context + ApiService *DefaultApiService +} + +func (r ApiListScopesRequest) Execute() (*ListScopesResponse, *http.Response, error) { + return r.ApiService.ListScopesExecute(r) +} + +/* +ListScopes List scopes + +List Scopes + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListScopesRequest +*/ +func (a *DefaultApiService) ListScopes(ctx context.Context) ApiListScopesRequest { + return ApiListScopesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ListScopesResponse +func (a *DefaultApiService) ListScopesExecute(r ApiListScopesRequest) (*ListScopesResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListScopesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListScopes") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/scopes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiReadClientRequest struct { + ctx context.Context + ApiService *DefaultApiService + clientId string +} + +func (r ApiReadClientRequest) Execute() (*ReadClientResponse, *http.Response, error) { + return r.ApiService.ReadClientExecute(r) +} + +/* +ReadClient Read client + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clientId Client ID + @return ApiReadClientRequest +*/ +func (a *DefaultApiService) ReadClient(ctx context.Context, clientId string) ApiReadClientRequest { + return ApiReadClientRequest{ + ApiService: a, + ctx: ctx, + clientId: clientId, + } +} + +// Execute executes the request +// @return ReadClientResponse +func (a *DefaultApiService) ReadClientExecute(r ApiReadClientRequest) (*ReadClientResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ReadClientResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ReadClient") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clients/{clientId}" + localVarPath = strings.Replace(localVarPath, "{"+"clientId"+"}", url.PathEscape(parameterToString(r.clientId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiReadScopeRequest struct { + ctx context.Context + ApiService *DefaultApiService + scopeId string +} + +func (r ApiReadScopeRequest) Execute() (*CreateScopeResponse, *http.Response, error) { + return r.ApiService.ReadScopeExecute(r) +} + +/* +ReadScope Read scope + +Read scope + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param scopeId Scope ID + @return ApiReadScopeRequest +*/ +func (a *DefaultApiService) ReadScope(ctx context.Context, scopeId string) ApiReadScopeRequest { + return ApiReadScopeRequest{ + ApiService: a, + ctx: ctx, + scopeId: scopeId, + } +} + +// Execute executes the request +// @return CreateScopeResponse +func (a *DefaultApiService) ReadScopeExecute(r ApiReadScopeRequest) (*CreateScopeResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateScopeResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ReadScope") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/scopes/{scopeId}" + localVarPath = strings.Replace(localVarPath, "{"+"scopeId"+"}", url.PathEscape(parameterToString(r.scopeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateClientRequest struct { + ctx context.Context + ApiService *DefaultApiService + clientId string + body *ClientOptions +} + +func (r ApiUpdateClientRequest) Body(body ClientOptions) ApiUpdateClientRequest { + r.body = &body + return r +} + +func (r ApiUpdateClientRequest) Execute() (*CreateClientResponse, *http.Response, error) { + return r.ApiService.UpdateClientExecute(r) +} + +/* +UpdateClient Update client + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clientId Client ID + @return ApiUpdateClientRequest +*/ +func (a *DefaultApiService) UpdateClient(ctx context.Context, clientId string) ApiUpdateClientRequest { + return ApiUpdateClientRequest{ + ApiService: a, + ctx: ctx, + clientId: clientId, + } +} + +// Execute executes the request +// @return CreateClientResponse +func (a *DefaultApiService) UpdateClientExecute(r ApiUpdateClientRequest) (*CreateClientResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateClientResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateClient") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clients/{clientId}" + localVarPath = strings.Replace(localVarPath, "{"+"clientId"+"}", url.PathEscape(parameterToString(r.clientId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateScopeRequest struct { + ctx context.Context + ApiService *DefaultApiService + scopeId string + body *ClientOptions +} + +func (r ApiUpdateScopeRequest) Body(body ClientOptions) ApiUpdateScopeRequest { + r.body = &body + return r +} + +func (r ApiUpdateScopeRequest) Execute() (*CreateScopeResponse, *http.Response, error) { + return r.ApiService.UpdateScopeExecute(r) +} + +/* +UpdateScope Update scope + +Update scope + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param scopeId Scope ID + @return ApiUpdateScopeRequest +*/ +func (a *DefaultApiService) UpdateScope(ctx context.Context, scopeId string) ApiUpdateScopeRequest { + return ApiUpdateScopeRequest{ + ApiService: a, + ctx: ctx, + scopeId: scopeId, + } +} + +// Execute executes the request +// @return CreateScopeResponse +func (a *DefaultApiService) UpdateScopeExecute(r ApiUpdateScopeRequest) (*CreateScopeResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateScopeResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateScope") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/scopes/{scopeId}" + localVarPath = strings.Replace(localVarPath, "{"+"scopeId"+"}", url.PathEscape(parameterToString(r.scopeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/pkg/client/client.go b/pkg/client/client.go new file mode 100644 index 0000000..19ad4f4 --- /dev/null +++ b/pkg/client/client.go @@ -0,0 +1,563 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "io/ioutil" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) +) + +// APIClient manages communication with the Auth API API vAUTH_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 + + DefaultApi *DefaultApiService +} + +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 + + // API Services + c.DefaultApi = (*DefaultApiService)(&c.common) + + 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 insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, 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 +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// 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, + formFiles []formFile) (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(formFiles) > 0) { + 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) + } + } + } + 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 + } + } + } + + // 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[h] = []string{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) + } + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + 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 f, ok := v.(**os.File); ok { + *f, err = ioutil.TempFile("", "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 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(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + 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...) +} + +// A wrapper for strict JSON decoding +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 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) { + 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/pkg/client/configuration.go b/pkg/client/configuration.go new file mode 100644 index 0000000..41902d3 --- /dev/null +++ b/pkg/client/configuration.go @@ -0,0 +1,236 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +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") + + // 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 +} + +// 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: "OpenAPI-Generator/latest/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "https://{organization}.o.numary.cloud/auth", + Description: "Production server", + Variables: map[string]ServerVariable{ + "organization": ServerVariable{ + Description: "The organization on which the auth server is located", + DefaultValue: "", + }, + }, + }, + }, + OperationServers: map[string]ServerConfigurations{ + }, + } + 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/pkg/client/docs/Client.md b/pkg/client/docs/Client.md new file mode 100644 index 0000000..43ea4fa --- /dev/null +++ b/pkg/client/docs/Client.md @@ -0,0 +1,202 @@ +# Client + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Public** | Pointer to **bool** | | [optional] +**RedirectUris** | Pointer to **[]string** | | [optional] +**Description** | Pointer to **string** | | [optional] +**Name** | **string** | | +**PostLogoutRedirectUris** | Pointer to **[]string** | | [optional] +**Id** | **string** | | +**Scopes** | Pointer to **[]string** | | [optional] + +## Methods + +### NewClient + +`func NewClient(name string, id string, ) *Client` + +NewClient instantiates a new Client 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 + +### NewClientWithDefaults + +`func NewClientWithDefaults() *Client` + +NewClientWithDefaults instantiates a new Client 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 + +### GetPublic + +`func (o *Client) GetPublic() bool` + +GetPublic returns the Public field if non-nil, zero value otherwise. + +### GetPublicOk + +`func (o *Client) GetPublicOk() (*bool, bool)` + +GetPublicOk returns a tuple with the Public field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublic + +`func (o *Client) SetPublic(v bool)` + +SetPublic sets Public field to given value. + +### HasPublic + +`func (o *Client) HasPublic() bool` + +HasPublic returns a boolean if a field has been set. + +### GetRedirectUris + +`func (o *Client) GetRedirectUris() []string` + +GetRedirectUris returns the RedirectUris field if non-nil, zero value otherwise. + +### GetRedirectUrisOk + +`func (o *Client) GetRedirectUrisOk() (*[]string, bool)` + +GetRedirectUrisOk returns a tuple with the RedirectUris field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRedirectUris + +`func (o *Client) SetRedirectUris(v []string)` + +SetRedirectUris sets RedirectUris field to given value. + +### HasRedirectUris + +`func (o *Client) HasRedirectUris() bool` + +HasRedirectUris returns a boolean if a field has been set. + +### GetDescription + +`func (o *Client) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *Client) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *Client) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *Client) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetName + +`func (o *Client) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Client) GetNameOk() (*string, bool)` + +GetNameOk 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. + +### SetName + +`func (o *Client) SetName(v string)` + +SetName sets Name field to given value. + + +### GetPostLogoutRedirectUris + +`func (o *Client) GetPostLogoutRedirectUris() []string` + +GetPostLogoutRedirectUris returns the PostLogoutRedirectUris field if non-nil, zero value otherwise. + +### GetPostLogoutRedirectUrisOk + +`func (o *Client) GetPostLogoutRedirectUrisOk() (*[]string, bool)` + +GetPostLogoutRedirectUrisOk returns a tuple with the PostLogoutRedirectUris field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPostLogoutRedirectUris + +`func (o *Client) SetPostLogoutRedirectUris(v []string)` + +SetPostLogoutRedirectUris sets PostLogoutRedirectUris field to given value. + +### HasPostLogoutRedirectUris + +`func (o *Client) HasPostLogoutRedirectUris() bool` + +HasPostLogoutRedirectUris returns a boolean if a field has been set. + +### GetId + +`func (o *Client) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Client) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Client) SetId(v string)` + +SetId sets Id field to given value. + + +### GetScopes + +`func (o *Client) GetScopes() []string` + +GetScopes returns the Scopes field if non-nil, zero value otherwise. + +### GetScopesOk + +`func (o *Client) GetScopesOk() (*[]string, bool)` + +GetScopesOk returns a tuple with the Scopes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetScopes + +`func (o *Client) SetScopes(v []string)` + +SetScopes sets Scopes field to given value. + +### HasScopes + +`func (o *Client) HasScopes() bool` + +HasScopes returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/client/docs/ClientAllOf.md b/pkg/client/docs/ClientAllOf.md new file mode 100644 index 0000000..8dc990e --- /dev/null +++ b/pkg/client/docs/ClientAllOf.md @@ -0,0 +1,77 @@ +# ClientAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | | +**Scopes** | Pointer to **[]string** | | [optional] + +## Methods + +### NewClientAllOf + +`func NewClientAllOf(id string, ) *ClientAllOf` + +NewClientAllOf instantiates a new ClientAllOf 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 + +### NewClientAllOfWithDefaults + +`func NewClientAllOfWithDefaults() *ClientAllOf` + +NewClientAllOfWithDefaults instantiates a new ClientAllOf 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 + +### GetId + +`func (o *ClientAllOf) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *ClientAllOf) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *ClientAllOf) SetId(v string)` + +SetId sets Id field to given value. + + +### GetScopes + +`func (o *ClientAllOf) GetScopes() []string` + +GetScopes returns the Scopes field if non-nil, zero value otherwise. + +### GetScopesOk + +`func (o *ClientAllOf) GetScopesOk() (*[]string, bool)` + +GetScopesOk returns a tuple with the Scopes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetScopes + +`func (o *ClientAllOf) SetScopes(v []string)` + +SetScopes sets Scopes field to given value. + +### HasScopes + +`func (o *ClientAllOf) HasScopes() bool` + +HasScopes returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/client/docs/ClientOptions.md b/pkg/client/docs/ClientOptions.md new file mode 100644 index 0000000..71c685a --- /dev/null +++ b/pkg/client/docs/ClientOptions.md @@ -0,0 +1,155 @@ +# ClientOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Public** | Pointer to **bool** | | [optional] +**RedirectUris** | Pointer to **[]string** | | [optional] +**Description** | Pointer to **string** | | [optional] +**Name** | **string** | | +**PostLogoutRedirectUris** | Pointer to **[]string** | | [optional] + +## Methods + +### NewClientOptions + +`func NewClientOptions(name string, ) *ClientOptions` + +NewClientOptions instantiates a new ClientOptions 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 + +### NewClientOptionsWithDefaults + +`func NewClientOptionsWithDefaults() *ClientOptions` + +NewClientOptionsWithDefaults instantiates a new ClientOptions 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 + +### GetPublic + +`func (o *ClientOptions) GetPublic() bool` + +GetPublic returns the Public field if non-nil, zero value otherwise. + +### GetPublicOk + +`func (o *ClientOptions) GetPublicOk() (*bool, bool)` + +GetPublicOk returns a tuple with the Public field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublic + +`func (o *ClientOptions) SetPublic(v bool)` + +SetPublic sets Public field to given value. + +### HasPublic + +`func (o *ClientOptions) HasPublic() bool` + +HasPublic returns a boolean if a field has been set. + +### GetRedirectUris + +`func (o *ClientOptions) GetRedirectUris() []string` + +GetRedirectUris returns the RedirectUris field if non-nil, zero value otherwise. + +### GetRedirectUrisOk + +`func (o *ClientOptions) GetRedirectUrisOk() (*[]string, bool)` + +GetRedirectUrisOk returns a tuple with the RedirectUris field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRedirectUris + +`func (o *ClientOptions) SetRedirectUris(v []string)` + +SetRedirectUris sets RedirectUris field to given value. + +### HasRedirectUris + +`func (o *ClientOptions) HasRedirectUris() bool` + +HasRedirectUris returns a boolean if a field has been set. + +### GetDescription + +`func (o *ClientOptions) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *ClientOptions) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *ClientOptions) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *ClientOptions) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetName + +`func (o *ClientOptions) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *ClientOptions) GetNameOk() (*string, bool)` + +GetNameOk 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. + +### SetName + +`func (o *ClientOptions) SetName(v string)` + +SetName sets Name field to given value. + + +### GetPostLogoutRedirectUris + +`func (o *ClientOptions) GetPostLogoutRedirectUris() []string` + +GetPostLogoutRedirectUris returns the PostLogoutRedirectUris field if non-nil, zero value otherwise. + +### GetPostLogoutRedirectUrisOk + +`func (o *ClientOptions) GetPostLogoutRedirectUrisOk() (*[]string, bool)` + +GetPostLogoutRedirectUrisOk returns a tuple with the PostLogoutRedirectUris field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPostLogoutRedirectUris + +`func (o *ClientOptions) SetPostLogoutRedirectUris(v []string)` + +SetPostLogoutRedirectUris sets PostLogoutRedirectUris field to given value. + +### HasPostLogoutRedirectUris + +`func (o *ClientOptions) HasPostLogoutRedirectUris() bool` + +HasPostLogoutRedirectUris returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/client/docs/CreateClientResponse.md b/pkg/client/docs/CreateClientResponse.md new file mode 100644 index 0000000..5a4a8f8 --- /dev/null +++ b/pkg/client/docs/CreateClientResponse.md @@ -0,0 +1,56 @@ +# CreateClientResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | Pointer to [**Client**](Client.md) | | [optional] + +## Methods + +### NewCreateClientResponse + +`func NewCreateClientResponse() *CreateClientResponse` + +NewCreateClientResponse instantiates a new CreateClientResponse 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 + +### NewCreateClientResponseWithDefaults + +`func NewCreateClientResponseWithDefaults() *CreateClientResponse` + +NewCreateClientResponseWithDefaults instantiates a new CreateClientResponse 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 + +### GetData + +`func (o *CreateClientResponse) GetData() Client` + +GetData returns the Data field if non-nil, zero value otherwise. + +### GetDataOk + +`func (o *CreateClientResponse) GetDataOk() (*Client, bool)` + +GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetData + +`func (o *CreateClientResponse) SetData(v Client)` + +SetData sets Data field to given value. + +### HasData + +`func (o *CreateClientResponse) HasData() bool` + +HasData returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/client/docs/CreateScopeResponse.md b/pkg/client/docs/CreateScopeResponse.md new file mode 100644 index 0000000..fb6ad23 --- /dev/null +++ b/pkg/client/docs/CreateScopeResponse.md @@ -0,0 +1,56 @@ +# CreateScopeResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | Pointer to [**Scope**](Scope.md) | | [optional] + +## Methods + +### NewCreateScopeResponse + +`func NewCreateScopeResponse() *CreateScopeResponse` + +NewCreateScopeResponse instantiates a new CreateScopeResponse 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 + +### NewCreateScopeResponseWithDefaults + +`func NewCreateScopeResponseWithDefaults() *CreateScopeResponse` + +NewCreateScopeResponseWithDefaults instantiates a new CreateScopeResponse 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 + +### GetData + +`func (o *CreateScopeResponse) GetData() Scope` + +GetData returns the Data field if non-nil, zero value otherwise. + +### GetDataOk + +`func (o *CreateScopeResponse) GetDataOk() (*Scope, bool)` + +GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetData + +`func (o *CreateScopeResponse) SetData(v Scope)` + +SetData sets Data field to given value. + +### HasData + +`func (o *CreateScopeResponse) HasData() bool` + +HasData returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/client/docs/DefaultApi.md b/pkg/client/docs/DefaultApi.md new file mode 100644 index 0000000..2c432cb --- /dev/null +++ b/pkg/client/docs/DefaultApi.md @@ -0,0 +1,966 @@ +# \DefaultApi + +All URIs are relative to *https://.o.numary.cloud/auth* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddScopeToClient**](DefaultApi.md#AddScopeToClient) | **Put** /clients/{clientId}/scopes/{scopeId} | Add scope to client +[**AddTransientScope**](DefaultApi.md#AddTransientScope) | **Put** /scopes/{scopeId}/transient/{transientScopeId} | Add a transient scope to a scope +[**CreateClient**](DefaultApi.md#CreateClient) | **Post** /clients | Create client +[**CreateScope**](DefaultApi.md#CreateScope) | **Post** /scopes | Create scope +[**DeleteClient**](DefaultApi.md#DeleteClient) | **Delete** /clients/{clientId} | Delete client +[**DeleteScope**](DefaultApi.md#DeleteScope) | **Delete** /scopes/{scopeId} | Delete scope +[**DeleteScopeFromClient**](DefaultApi.md#DeleteScopeFromClient) | **Delete** /clients/{clientId}/scopes/{scopeId} | Delete scope from client +[**DeleteTransientScope**](DefaultApi.md#DeleteTransientScope) | **Delete** /scopes/{scopeId}/transient/{transientScopeId} | Delete a transient scope from a scope +[**ListClients**](DefaultApi.md#ListClients) | **Get** /clients | List clients +[**ListScopes**](DefaultApi.md#ListScopes) | **Get** /scopes | List scopes +[**ReadClient**](DefaultApi.md#ReadClient) | **Get** /clients/{clientId} | Read client +[**ReadScope**](DefaultApi.md#ReadScope) | **Get** /scopes/{scopeId} | Read scope +[**UpdateClient**](DefaultApi.md#UpdateClient) | **Put** /clients/{clientId} | Update client +[**UpdateScope**](DefaultApi.md#UpdateScope) | **Put** /scopes/{scopeId} | Update scope + + + +## AddScopeToClient + +> AddScopeToClient(ctx, clientId, scopeId).Execute() + +Add scope to client + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + clientId := "clientId_example" // string | Client ID + scopeId := "scopeId_example" // string | Scope ID + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.AddScopeToClient(context.Background(), clientId, scopeId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.AddScopeToClient``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clientId** | **string** | Client ID | +**scopeId** | **string** | Scope ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAddScopeToClientRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## AddTransientScope + +> AddTransientScope(ctx, scopeId, transientScopeId).Execute() + +Add a transient scope to a scope + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + scopeId := "scopeId_example" // string | Scope ID + transientScopeId := "transientScopeId_example" // string | Transient scope ID + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.AddTransientScope(context.Background(), scopeId, transientScopeId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.AddTransientScope``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**scopeId** | **string** | Scope ID | +**transientScopeId** | **string** | Transient scope ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAddTransientScopeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## CreateClient + +> CreateClientResponse CreateClient(ctx).Body(body).Execute() + +Create client + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := ClientOptions(987) // ClientOptions | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.CreateClient(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.CreateClient``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateClient`: CreateClientResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultApi.CreateClient`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateClientRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **ClientOptions** | | + +### Return type + +[**CreateClientResponse**](CreateClientResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[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) + + +## CreateScope + +> CreateScopeResponse CreateScope(ctx).Body(body).Execute() + +Create scope + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := ClientOptions(987) // ClientOptions | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.CreateScope(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.CreateScope``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateScope`: CreateScopeResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultApi.CreateScope`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateScopeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **ClientOptions** | | + +### Return type + +[**CreateScopeResponse**](CreateScopeResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[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) + + +## DeleteClient + +> DeleteClient(ctx, clientId).Execute() + +Delete client + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + clientId := "clientId_example" // string | Client ID + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.DeleteClient(context.Background(), clientId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.DeleteClient``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clientId** | **string** | Client ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteClientRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## DeleteScope + +> DeleteScope(ctx, scopeId).Execute() + +Delete scope + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + scopeId := "scopeId_example" // string | Scope ID + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.DeleteScope(context.Background(), scopeId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.DeleteScope``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**scopeId** | **string** | Scope ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteScopeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## DeleteScopeFromClient + +> DeleteScopeFromClient(ctx, clientId, scopeId).Execute() + +Delete scope from client + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + clientId := "clientId_example" // string | Client ID + scopeId := "scopeId_example" // string | Scope ID + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.DeleteScopeFromClient(context.Background(), clientId, scopeId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.DeleteScopeFromClient``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clientId** | **string** | Client ID | +**scopeId** | **string** | Scope ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteScopeFromClientRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## DeleteTransientScope + +> DeleteTransientScope(ctx, scopeId, transientScopeId).Execute() + +Delete a transient scope from a scope + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + scopeId := "scopeId_example" // string | Scope ID + transientScopeId := "transientScopeId_example" // string | Transient scope ID + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.DeleteTransientScope(context.Background(), scopeId, transientScopeId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.DeleteTransientScope``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**scopeId** | **string** | Scope ID | +**transientScopeId** | **string** | Transient scope ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteTransientScopeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## ListClients + +> ListClientsResponse ListClients(ctx).Execute() + +List clients + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.ListClients(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.ListClients``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ListClients`: ListClientsResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultApi.ListClients`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiListClientsRequest struct via the builder pattern + + +### Return type + +[**ListClientsResponse**](ListClientsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[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) + + +## ListScopes + +> ListScopesResponse ListScopes(ctx).Execute() + +List scopes + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.ListScopes(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.ListScopes``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ListScopes`: ListScopesResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultApi.ListScopes`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiListScopesRequest struct via the builder pattern + + +### Return type + +[**ListScopesResponse**](ListScopesResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[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) + + +## ReadClient + +> ReadClientResponse ReadClient(ctx, clientId).Execute() + +Read client + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + clientId := "clientId_example" // string | Client ID + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.ReadClient(context.Background(), clientId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.ReadClient``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ReadClient`: ReadClientResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultApi.ReadClient`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clientId** | **string** | Client ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiReadClientRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ReadClientResponse**](ReadClientResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[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) + + +## ReadScope + +> CreateScopeResponse ReadScope(ctx, scopeId).Execute() + +Read scope + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + scopeId := "scopeId_example" // string | Scope ID + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.ReadScope(context.Background(), scopeId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.ReadScope``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ReadScope`: CreateScopeResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultApi.ReadScope`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**scopeId** | **string** | Scope ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiReadScopeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**CreateScopeResponse**](CreateScopeResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[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) + + +## UpdateClient + +> CreateClientResponse UpdateClient(ctx, clientId).Body(body).Execute() + +Update client + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + clientId := "clientId_example" // string | Client ID + body := ClientOptions(987) // ClientOptions | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.UpdateClient(context.Background(), clientId).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.UpdateClient``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateClient`: CreateClientResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultApi.UpdateClient`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**clientId** | **string** | Client ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateClientRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **body** | **ClientOptions** | | + +### Return type + +[**CreateClientResponse**](CreateClientResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[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) + + +## UpdateScope + +> CreateScopeResponse UpdateScope(ctx, scopeId).Body(body).Execute() + +Update scope + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + scopeId := "scopeId_example" // string | Scope ID + body := ClientOptions(987) // ClientOptions | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultApi.UpdateScope(context.Background(), scopeId).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.UpdateScope``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateScope`: CreateScopeResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultApi.UpdateScope`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**scopeId** | **string** | Scope ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateScopeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **body** | **ClientOptions** | | + +### Return type + +[**CreateScopeResponse**](CreateScopeResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[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) + diff --git a/pkg/client/docs/ListClientsResponse.md b/pkg/client/docs/ListClientsResponse.md new file mode 100644 index 0000000..251b5a8 --- /dev/null +++ b/pkg/client/docs/ListClientsResponse.md @@ -0,0 +1,56 @@ +# ListClientsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | Pointer to [**[]Client**](Client.md) | | [optional] + +## Methods + +### NewListClientsResponse + +`func NewListClientsResponse() *ListClientsResponse` + +NewListClientsResponse instantiates a new ListClientsResponse 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 + +### NewListClientsResponseWithDefaults + +`func NewListClientsResponseWithDefaults() *ListClientsResponse` + +NewListClientsResponseWithDefaults instantiates a new ListClientsResponse 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 + +### GetData + +`func (o *ListClientsResponse) GetData() []Client` + +GetData returns the Data field if non-nil, zero value otherwise. + +### GetDataOk + +`func (o *ListClientsResponse) GetDataOk() (*[]Client, bool)` + +GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetData + +`func (o *ListClientsResponse) SetData(v []Client)` + +SetData sets Data field to given value. + +### HasData + +`func (o *ListClientsResponse) HasData() bool` + +HasData returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/client/docs/ListScopesResponse.md b/pkg/client/docs/ListScopesResponse.md new file mode 100644 index 0000000..fd152d2 --- /dev/null +++ b/pkg/client/docs/ListScopesResponse.md @@ -0,0 +1,56 @@ +# ListScopesResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | Pointer to [**[]Scope**](Scope.md) | | [optional] + +## Methods + +### NewListScopesResponse + +`func NewListScopesResponse() *ListScopesResponse` + +NewListScopesResponse instantiates a new ListScopesResponse 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 + +### NewListScopesResponseWithDefaults + +`func NewListScopesResponseWithDefaults() *ListScopesResponse` + +NewListScopesResponseWithDefaults instantiates a new ListScopesResponse 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 + +### GetData + +`func (o *ListScopesResponse) GetData() []Scope` + +GetData returns the Data field if non-nil, zero value otherwise. + +### GetDataOk + +`func (o *ListScopesResponse) GetDataOk() (*[]Scope, bool)` + +GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetData + +`func (o *ListScopesResponse) SetData(v []Scope)` + +SetData sets Data field to given value. + +### HasData + +`func (o *ListScopesResponse) HasData() bool` + +HasData returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/client/docs/ReadClientResponse.md b/pkg/client/docs/ReadClientResponse.md new file mode 100644 index 0000000..ae5af99 --- /dev/null +++ b/pkg/client/docs/ReadClientResponse.md @@ -0,0 +1,56 @@ +# ReadClientResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | Pointer to [**Client**](Client.md) | | [optional] + +## Methods + +### NewReadClientResponse + +`func NewReadClientResponse() *ReadClientResponse` + +NewReadClientResponse instantiates a new ReadClientResponse 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 + +### NewReadClientResponseWithDefaults + +`func NewReadClientResponseWithDefaults() *ReadClientResponse` + +NewReadClientResponseWithDefaults instantiates a new ReadClientResponse 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 + +### GetData + +`func (o *ReadClientResponse) GetData() Client` + +GetData returns the Data field if non-nil, zero value otherwise. + +### GetDataOk + +`func (o *ReadClientResponse) GetDataOk() (*Client, bool)` + +GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetData + +`func (o *ReadClientResponse) SetData(v Client)` + +SetData sets Data field to given value. + +### HasData + +`func (o *ReadClientResponse) HasData() bool` + +HasData returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/client/docs/Scope.md b/pkg/client/docs/Scope.md new file mode 100644 index 0000000..abf4980 --- /dev/null +++ b/pkg/client/docs/Scope.md @@ -0,0 +1,98 @@ +# Scope + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Label** | **string** | | +**Id** | **string** | | +**Transient** | Pointer to **[]string** | | [optional] + +## Methods + +### NewScope + +`func NewScope(label string, id string, ) *Scope` + +NewScope instantiates a new Scope 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 + +### NewScopeWithDefaults + +`func NewScopeWithDefaults() *Scope` + +NewScopeWithDefaults instantiates a new Scope 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 + +### GetLabel + +`func (o *Scope) GetLabel() string` + +GetLabel returns the Label field if non-nil, zero value otherwise. + +### GetLabelOk + +`func (o *Scope) GetLabelOk() (*string, bool)` + +GetLabelOk returns a tuple with the Label field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLabel + +`func (o *Scope) SetLabel(v string)` + +SetLabel sets Label field to given value. + + +### GetId + +`func (o *Scope) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Scope) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Scope) SetId(v string)` + +SetId sets Id field to given value. + + +### GetTransient + +`func (o *Scope) GetTransient() []string` + +GetTransient returns the Transient field if non-nil, zero value otherwise. + +### GetTransientOk + +`func (o *Scope) GetTransientOk() (*[]string, bool)` + +GetTransientOk returns a tuple with the Transient field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTransient + +`func (o *Scope) SetTransient(v []string)` + +SetTransient sets Transient field to given value. + +### HasTransient + +`func (o *Scope) HasTransient() bool` + +HasTransient returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/client/docs/ScopeAllOf.md b/pkg/client/docs/ScopeAllOf.md new file mode 100644 index 0000000..f3ebb73 --- /dev/null +++ b/pkg/client/docs/ScopeAllOf.md @@ -0,0 +1,77 @@ +# ScopeAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | | +**Transient** | Pointer to **[]string** | | [optional] + +## Methods + +### NewScopeAllOf + +`func NewScopeAllOf(id string, ) *ScopeAllOf` + +NewScopeAllOf instantiates a new ScopeAllOf 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 + +### NewScopeAllOfWithDefaults + +`func NewScopeAllOfWithDefaults() *ScopeAllOf` + +NewScopeAllOfWithDefaults instantiates a new ScopeAllOf 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 + +### GetId + +`func (o *ScopeAllOf) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *ScopeAllOf) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *ScopeAllOf) SetId(v string)` + +SetId sets Id field to given value. + + +### GetTransient + +`func (o *ScopeAllOf) GetTransient() []string` + +GetTransient returns the Transient field if non-nil, zero value otherwise. + +### GetTransientOk + +`func (o *ScopeAllOf) GetTransientOk() (*[]string, bool)` + +GetTransientOk returns a tuple with the Transient field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTransient + +`func (o *ScopeAllOf) SetTransient(v []string)` + +SetTransient sets Transient field to given value. + +### HasTransient + +`func (o *ScopeAllOf) HasTransient() bool` + +HasTransient returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/client/docs/ScopeOptions.md b/pkg/client/docs/ScopeOptions.md new file mode 100644 index 0000000..bf06e55 --- /dev/null +++ b/pkg/client/docs/ScopeOptions.md @@ -0,0 +1,51 @@ +# ScopeOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Label** | **string** | | + +## Methods + +### NewScopeOptions + +`func NewScopeOptions(label string, ) *ScopeOptions` + +NewScopeOptions instantiates a new ScopeOptions 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 + +### NewScopeOptionsWithDefaults + +`func NewScopeOptionsWithDefaults() *ScopeOptions` + +NewScopeOptionsWithDefaults instantiates a new ScopeOptions 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 + +### GetLabel + +`func (o *ScopeOptions) GetLabel() string` + +GetLabel returns the Label field if non-nil, zero value otherwise. + +### GetLabelOk + +`func (o *ScopeOptions) GetLabelOk() (*string, bool)` + +GetLabelOk returns a tuple with the Label field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLabel + +`func (o *ScopeOptions) SetLabel(v string)` + +SetLabel sets Label field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/client/git_push.sh b/pkg/client/git_push.sh new file mode 100644 index 0000000..e80321c --- /dev/null +++ b/pkg/client/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="numary" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="auth" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + 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/pkg/client/go.mod b/pkg/client/go.mod new file mode 100644 index 0000000..addc434 --- /dev/null +++ b/pkg/client/go.mod @@ -0,0 +1,7 @@ +module github.com/numary/auth/authclient + +go 1.13 + +require ( + golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558 +) diff --git a/pkg/client/go.sum b/pkg/client/go.sum new file mode 100644 index 0000000..734252e --- /dev/null +++ b/pkg/client/go.sum @@ -0,0 +1,13 @@ +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/pkg/client/model_client.go b/pkg/client/model_client.go new file mode 100644 index 0000000..49a05db --- /dev/null +++ b/pkg/client/model_client.go @@ -0,0 +1,317 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +import ( + "encoding/json" +) + +// Client struct for Client +type Client struct { + Public *bool `json:"public,omitempty"` + RedirectUris []string `json:"redirectUris,omitempty"` + Description *string `json:"description,omitempty"` + Name string `json:"name"` + PostLogoutRedirectUris []string `json:"postLogoutRedirectUris,omitempty"` + Id string `json:"id"` + Scopes []string `json:"scopes,omitempty"` +} + +// NewClient instantiates a new Client 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 NewClient(name string, id string) *Client { + this := Client{} + this.Name = name + this.Id = id + return &this +} + +// NewClientWithDefaults instantiates a new Client 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 NewClientWithDefaults() *Client { + this := Client{} + return &this +} + +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *Client) GetPublic() bool { + if o == nil || o.Public == nil { + var ret bool + return ret + } + return *o.Public +} + +// GetPublicOk returns a tuple with the Public field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Client) GetPublicOk() (*bool, bool) { + if o == nil || o.Public == nil { + return nil, false + } + return o.Public, true +} + +// HasPublic returns a boolean if a field has been set. +func (o *Client) HasPublic() bool { + if o != nil && o.Public != nil { + return true + } + + return false +} + +// SetPublic gets a reference to the given bool and assigns it to the Public field. +func (o *Client) SetPublic(v bool) { + o.Public = &v +} + +// GetRedirectUris returns the RedirectUris field value if set, zero value otherwise. +func (o *Client) GetRedirectUris() []string { + if o == nil || o.RedirectUris == nil { + var ret []string + return ret + } + return o.RedirectUris +} + +// 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 *Client) GetRedirectUrisOk() ([]string, bool) { + if o == nil || o.RedirectUris == nil { + return nil, false + } + return o.RedirectUris, true +} + +// HasRedirectUris returns a boolean if a field has been set. +func (o *Client) HasRedirectUris() bool { + if o != nil && o.RedirectUris != nil { + return true + } + + return false +} + +// SetRedirectUris gets a reference to the given []string and assigns it to the RedirectUris field. +func (o *Client) SetRedirectUris(v []string) { + o.RedirectUris = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Client) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Client) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Client) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Client) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value +func (o *Client) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Client) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Client) SetName(v string) { + o.Name = v +} + +// GetPostLogoutRedirectUris returns the PostLogoutRedirectUris field value if set, zero value otherwise. +func (o *Client) GetPostLogoutRedirectUris() []string { + if o == nil || o.PostLogoutRedirectUris == nil { + var ret []string + return ret + } + return o.PostLogoutRedirectUris +} + +// 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 *Client) GetPostLogoutRedirectUrisOk() ([]string, bool) { + if o == nil || o.PostLogoutRedirectUris == nil { + return nil, false + } + return o.PostLogoutRedirectUris, true +} + +// HasPostLogoutRedirectUris returns a boolean if a field has been set. +func (o *Client) HasPostLogoutRedirectUris() bool { + if o != nil && o.PostLogoutRedirectUris != nil { + return true + } + + return false +} + +// SetPostLogoutRedirectUris gets a reference to the given []string and assigns it to the PostLogoutRedirectUris field. +func (o *Client) SetPostLogoutRedirectUris(v []string) { + o.PostLogoutRedirectUris = v +} + +// GetId returns the Id field value +func (o *Client) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Client) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Client) SetId(v string) { + o.Id = v +} + +// GetScopes returns the Scopes field value if set, zero value otherwise. +func (o *Client) GetScopes() []string { + if o == nil || o.Scopes == nil { + var ret []string + return ret + } + return o.Scopes +} + +// GetScopesOk returns a tuple with the Scopes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Client) GetScopesOk() ([]string, bool) { + if o == nil || o.Scopes == nil { + return nil, false + } + return o.Scopes, true +} + +// HasScopes returns a boolean if a field has been set. +func (o *Client) HasScopes() bool { + if o != nil && o.Scopes != nil { + return true + } + + return false +} + +// SetScopes gets a reference to the given []string and assigns it to the Scopes field. +func (o *Client) SetScopes(v []string) { + o.Scopes = v +} + +func (o Client) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Public != nil { + toSerialize["public"] = o.Public + } + if o.RedirectUris != nil { + toSerialize["redirectUris"] = o.RedirectUris + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if true { + toSerialize["name"] = o.Name + } + if o.PostLogoutRedirectUris != nil { + toSerialize["postLogoutRedirectUris"] = o.PostLogoutRedirectUris + } + if true { + toSerialize["id"] = o.Id + } + if o.Scopes != nil { + toSerialize["scopes"] = o.Scopes + } + return json.Marshal(toSerialize) +} + +type NullableClient struct { + value *Client + isSet bool +} + +func (v NullableClient) Get() *Client { + return v.value +} + +func (v *NullableClient) Set(val *Client) { + v.value = val + v.isSet = true +} + +func (v NullableClient) IsSet() bool { + return v.isSet +} + +func (v *NullableClient) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClient(val *Client) *NullableClient { + return &NullableClient{value: val, isSet: true} +} + +func (v NullableClient) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClient) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/pkg/client/model_client_all_of.go b/pkg/client/model_client_all_of.go new file mode 100644 index 0000000..87fd29a --- /dev/null +++ b/pkg/client/model_client_all_of.go @@ -0,0 +1,144 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +import ( + "encoding/json" +) + +// ClientAllOf struct for ClientAllOf +type ClientAllOf struct { + Id string `json:"id"` + Scopes []string `json:"scopes,omitempty"` +} + +// NewClientAllOf instantiates a new ClientAllOf 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 NewClientAllOf(id string) *ClientAllOf { + this := ClientAllOf{} + this.Id = id + return &this +} + +// NewClientAllOfWithDefaults instantiates a new ClientAllOf 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 NewClientAllOfWithDefaults() *ClientAllOf { + this := ClientAllOf{} + return &this +} + +// GetId returns the Id field value +func (o *ClientAllOf) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ClientAllOf) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ClientAllOf) SetId(v string) { + o.Id = v +} + +// GetScopes returns the Scopes field value if set, zero value otherwise. +func (o *ClientAllOf) GetScopes() []string { + if o == nil || o.Scopes == nil { + var ret []string + return ret + } + return o.Scopes +} + +// GetScopesOk returns a tuple with the Scopes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ClientAllOf) GetScopesOk() ([]string, bool) { + if o == nil || o.Scopes == nil { + return nil, false + } + return o.Scopes, true +} + +// HasScopes returns a boolean if a field has been set. +func (o *ClientAllOf) HasScopes() bool { + if o != nil && o.Scopes != nil { + return true + } + + return false +} + +// SetScopes gets a reference to the given []string and assigns it to the Scopes field. +func (o *ClientAllOf) SetScopes(v []string) { + o.Scopes = v +} + +func (o ClientAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["id"] = o.Id + } + if o.Scopes != nil { + toSerialize["scopes"] = o.Scopes + } + return json.Marshal(toSerialize) +} + +type NullableClientAllOf struct { + value *ClientAllOf + isSet bool +} + +func (v NullableClientAllOf) Get() *ClientAllOf { + return v.value +} + +func (v *NullableClientAllOf) Set(val *ClientAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableClientAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableClientAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClientAllOf(val *ClientAllOf) *NullableClientAllOf { + return &NullableClientAllOf{value: val, isSet: true} +} + +func (v NullableClientAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClientAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/pkg/client/model_client_options.go b/pkg/client/model_client_options.go new file mode 100644 index 0000000..1da37fc --- /dev/null +++ b/pkg/client/model_client_options.go @@ -0,0 +1,252 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +import ( + "encoding/json" +) + +// ClientOptions struct for ClientOptions +type ClientOptions struct { + Public *bool `json:"public,omitempty"` + RedirectUris []string `json:"redirectUris,omitempty"` + Description *string `json:"description,omitempty"` + Name string `json:"name"` + PostLogoutRedirectUris []string `json:"postLogoutRedirectUris,omitempty"` +} + +// NewClientOptions instantiates a new ClientOptions 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 NewClientOptions(name string) *ClientOptions { + this := ClientOptions{} + this.Name = name + return &this +} + +// NewClientOptionsWithDefaults instantiates a new ClientOptions 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 NewClientOptionsWithDefaults() *ClientOptions { + this := ClientOptions{} + return &this +} + +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *ClientOptions) GetPublic() bool { + if o == nil || o.Public == nil { + var ret bool + return ret + } + return *o.Public +} + +// GetPublicOk returns a tuple with the Public field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ClientOptions) GetPublicOk() (*bool, bool) { + if o == nil || o.Public == nil { + return nil, false + } + return o.Public, true +} + +// HasPublic returns a boolean if a field has been set. +func (o *ClientOptions) HasPublic() bool { + if o != nil && o.Public != nil { + return true + } + + return false +} + +// SetPublic gets a reference to the given bool and assigns it to the Public field. +func (o *ClientOptions) SetPublic(v bool) { + o.Public = &v +} + +// GetRedirectUris returns the RedirectUris field value if set, zero value otherwise. +func (o *ClientOptions) GetRedirectUris() []string { + if o == nil || o.RedirectUris == nil { + var ret []string + return ret + } + return o.RedirectUris +} + +// 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 *ClientOptions) GetRedirectUrisOk() ([]string, bool) { + if o == nil || o.RedirectUris == nil { + return nil, false + } + return o.RedirectUris, true +} + +// HasRedirectUris returns a boolean if a field has been set. +func (o *ClientOptions) HasRedirectUris() bool { + if o != nil && o.RedirectUris != nil { + return true + } + + return false +} + +// SetRedirectUris gets a reference to the given []string and assigns it to the RedirectUris field. +func (o *ClientOptions) SetRedirectUris(v []string) { + o.RedirectUris = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *ClientOptions) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ClientOptions) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *ClientOptions) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *ClientOptions) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value +func (o *ClientOptions) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ClientOptions) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ClientOptions) SetName(v string) { + o.Name = v +} + +// GetPostLogoutRedirectUris returns the PostLogoutRedirectUris field value if set, zero value otherwise. +func (o *ClientOptions) GetPostLogoutRedirectUris() []string { + if o == nil || o.PostLogoutRedirectUris == nil { + var ret []string + return ret + } + return o.PostLogoutRedirectUris +} + +// 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 *ClientOptions) GetPostLogoutRedirectUrisOk() ([]string, bool) { + if o == nil || o.PostLogoutRedirectUris == nil { + return nil, false + } + return o.PostLogoutRedirectUris, true +} + +// HasPostLogoutRedirectUris returns a boolean if a field has been set. +func (o *ClientOptions) HasPostLogoutRedirectUris() bool { + if o != nil && o.PostLogoutRedirectUris != nil { + return true + } + + return false +} + +// SetPostLogoutRedirectUris gets a reference to the given []string and assigns it to the PostLogoutRedirectUris field. +func (o *ClientOptions) SetPostLogoutRedirectUris(v []string) { + o.PostLogoutRedirectUris = v +} + +func (o ClientOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Public != nil { + toSerialize["public"] = o.Public + } + if o.RedirectUris != nil { + toSerialize["redirectUris"] = o.RedirectUris + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if true { + toSerialize["name"] = o.Name + } + if o.PostLogoutRedirectUris != nil { + toSerialize["postLogoutRedirectUris"] = o.PostLogoutRedirectUris + } + return json.Marshal(toSerialize) +} + +type NullableClientOptions struct { + value *ClientOptions + isSet bool +} + +func (v NullableClientOptions) Get() *ClientOptions { + return v.value +} + +func (v *NullableClientOptions) Set(val *ClientOptions) { + v.value = val + v.isSet = true +} + +func (v NullableClientOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableClientOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClientOptions(val *ClientOptions) *NullableClientOptions { + return &NullableClientOptions{value: val, isSet: true} +} + +func (v NullableClientOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClientOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/pkg/client/model_create_client_response.go b/pkg/client/model_create_client_response.go new file mode 100644 index 0000000..3ff32b2 --- /dev/null +++ b/pkg/client/model_create_client_response.go @@ -0,0 +1,115 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +import ( + "encoding/json" +) + +// CreateClientResponse struct for CreateClientResponse +type CreateClientResponse struct { + Data *Client `json:"data,omitempty"` +} + +// NewCreateClientResponse instantiates a new CreateClientResponse 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 NewCreateClientResponse() *CreateClientResponse { + this := CreateClientResponse{} + return &this +} + +// NewCreateClientResponseWithDefaults instantiates a new CreateClientResponse 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 NewCreateClientResponseWithDefaults() *CreateClientResponse { + this := CreateClientResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CreateClientResponse) GetData() Client { + if o == nil || o.Data == nil { + var ret Client + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateClientResponse) GetDataOk() (*Client, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CreateClientResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given Client and assigns it to the Data field. +func (o *CreateClientResponse) SetData(v Client) { + o.Data = &v +} + +func (o CreateClientResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Data != nil { + toSerialize["data"] = o.Data + } + return json.Marshal(toSerialize) +} + +type NullableCreateClientResponse struct { + value *CreateClientResponse + isSet bool +} + +func (v NullableCreateClientResponse) Get() *CreateClientResponse { + return v.value +} + +func (v *NullableCreateClientResponse) Set(val *CreateClientResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateClientResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateClientResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateClientResponse(val *CreateClientResponse) *NullableCreateClientResponse { + return &NullableCreateClientResponse{value: val, isSet: true} +} + +func (v NullableCreateClientResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateClientResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/pkg/client/model_create_scope_response.go b/pkg/client/model_create_scope_response.go new file mode 100644 index 0000000..123d33e --- /dev/null +++ b/pkg/client/model_create_scope_response.go @@ -0,0 +1,115 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +import ( + "encoding/json" +) + +// CreateScopeResponse struct for CreateScopeResponse +type CreateScopeResponse struct { + Data *Scope `json:"data,omitempty"` +} + +// NewCreateScopeResponse instantiates a new CreateScopeResponse 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 NewCreateScopeResponse() *CreateScopeResponse { + this := CreateScopeResponse{} + return &this +} + +// NewCreateScopeResponseWithDefaults instantiates a new CreateScopeResponse 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 NewCreateScopeResponseWithDefaults() *CreateScopeResponse { + this := CreateScopeResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CreateScopeResponse) GetData() Scope { + if o == nil || o.Data == nil { + var ret Scope + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateScopeResponse) GetDataOk() (*Scope, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CreateScopeResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given Scope and assigns it to the Data field. +func (o *CreateScopeResponse) SetData(v Scope) { + o.Data = &v +} + +func (o CreateScopeResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Data != nil { + toSerialize["data"] = o.Data + } + return json.Marshal(toSerialize) +} + +type NullableCreateScopeResponse struct { + value *CreateScopeResponse + isSet bool +} + +func (v NullableCreateScopeResponse) Get() *CreateScopeResponse { + return v.value +} + +func (v *NullableCreateScopeResponse) Set(val *CreateScopeResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateScopeResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateScopeResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateScopeResponse(val *CreateScopeResponse) *NullableCreateScopeResponse { + return &NullableCreateScopeResponse{value: val, isSet: true} +} + +func (v NullableCreateScopeResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateScopeResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/pkg/client/model_list_clients_response.go b/pkg/client/model_list_clients_response.go new file mode 100644 index 0000000..a19932e --- /dev/null +++ b/pkg/client/model_list_clients_response.go @@ -0,0 +1,115 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +import ( + "encoding/json" +) + +// ListClientsResponse struct for ListClientsResponse +type ListClientsResponse struct { + Data []Client `json:"data,omitempty"` +} + +// NewListClientsResponse instantiates a new ListClientsResponse 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 NewListClientsResponse() *ListClientsResponse { + this := ListClientsResponse{} + return &this +} + +// NewListClientsResponseWithDefaults instantiates a new ListClientsResponse 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 NewListClientsResponseWithDefaults() *ListClientsResponse { + this := ListClientsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *ListClientsResponse) GetData() []Client { + if o == nil || o.Data == nil { + var ret []Client + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListClientsResponse) GetDataOk() ([]Client, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *ListClientsResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []Client and assigns it to the Data field. +func (o *ListClientsResponse) SetData(v []Client) { + o.Data = v +} + +func (o ListClientsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Data != nil { + toSerialize["data"] = o.Data + } + return json.Marshal(toSerialize) +} + +type NullableListClientsResponse struct { + value *ListClientsResponse + isSet bool +} + +func (v NullableListClientsResponse) Get() *ListClientsResponse { + return v.value +} + +func (v *NullableListClientsResponse) Set(val *ListClientsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListClientsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListClientsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListClientsResponse(val *ListClientsResponse) *NullableListClientsResponse { + return &NullableListClientsResponse{value: val, isSet: true} +} + +func (v NullableListClientsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListClientsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/pkg/client/model_list_scopes_response.go b/pkg/client/model_list_scopes_response.go new file mode 100644 index 0000000..14f718c --- /dev/null +++ b/pkg/client/model_list_scopes_response.go @@ -0,0 +1,115 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +import ( + "encoding/json" +) + +// ListScopesResponse struct for ListScopesResponse +type ListScopesResponse struct { + Data []Scope `json:"data,omitempty"` +} + +// NewListScopesResponse instantiates a new ListScopesResponse 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 NewListScopesResponse() *ListScopesResponse { + this := ListScopesResponse{} + return &this +} + +// NewListScopesResponseWithDefaults instantiates a new ListScopesResponse 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 NewListScopesResponseWithDefaults() *ListScopesResponse { + this := ListScopesResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *ListScopesResponse) GetData() []Scope { + if o == nil || o.Data == nil { + var ret []Scope + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListScopesResponse) GetDataOk() ([]Scope, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *ListScopesResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []Scope and assigns it to the Data field. +func (o *ListScopesResponse) SetData(v []Scope) { + o.Data = v +} + +func (o ListScopesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Data != nil { + toSerialize["data"] = o.Data + } + return json.Marshal(toSerialize) +} + +type NullableListScopesResponse struct { + value *ListScopesResponse + isSet bool +} + +func (v NullableListScopesResponse) Get() *ListScopesResponse { + return v.value +} + +func (v *NullableListScopesResponse) Set(val *ListScopesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListScopesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListScopesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListScopesResponse(val *ListScopesResponse) *NullableListScopesResponse { + return &NullableListScopesResponse{value: val, isSet: true} +} + +func (v NullableListScopesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListScopesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/pkg/client/model_read_client_response.go b/pkg/client/model_read_client_response.go new file mode 100644 index 0000000..efcd512 --- /dev/null +++ b/pkg/client/model_read_client_response.go @@ -0,0 +1,115 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +import ( + "encoding/json" +) + +// ReadClientResponse struct for ReadClientResponse +type ReadClientResponse struct { + Data *Client `json:"data,omitempty"` +} + +// NewReadClientResponse instantiates a new ReadClientResponse 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 NewReadClientResponse() *ReadClientResponse { + this := ReadClientResponse{} + return &this +} + +// NewReadClientResponseWithDefaults instantiates a new ReadClientResponse 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 NewReadClientResponseWithDefaults() *ReadClientResponse { + this := ReadClientResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *ReadClientResponse) GetData() Client { + if o == nil || o.Data == nil { + var ret Client + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReadClientResponse) GetDataOk() (*Client, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *ReadClientResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given Client and assigns it to the Data field. +func (o *ReadClientResponse) SetData(v Client) { + o.Data = &v +} + +func (o ReadClientResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Data != nil { + toSerialize["data"] = o.Data + } + return json.Marshal(toSerialize) +} + +type NullableReadClientResponse struct { + value *ReadClientResponse + isSet bool +} + +func (v NullableReadClientResponse) Get() *ReadClientResponse { + return v.value +} + +func (v *NullableReadClientResponse) Set(val *ReadClientResponse) { + v.value = val + v.isSet = true +} + +func (v NullableReadClientResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableReadClientResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReadClientResponse(val *ReadClientResponse) *NullableReadClientResponse { + return &NullableReadClientResponse{value: val, isSet: true} +} + +func (v NullableReadClientResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReadClientResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/pkg/client/model_scope.go b/pkg/client/model_scope.go new file mode 100644 index 0000000..ace212d --- /dev/null +++ b/pkg/client/model_scope.go @@ -0,0 +1,173 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +import ( + "encoding/json" +) + +// Scope struct for Scope +type Scope struct { + Label string `json:"label"` + Id string `json:"id"` + Transient []string `json:"transient,omitempty"` +} + +// NewScope instantiates a new Scope 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 NewScope(label string, id string) *Scope { + this := Scope{} + this.Label = label + this.Id = id + return &this +} + +// NewScopeWithDefaults instantiates a new Scope 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 NewScopeWithDefaults() *Scope { + this := Scope{} + return &this +} + +// GetLabel returns the Label field value +func (o *Scope) GetLabel() string { + if o == nil { + var ret string + return ret + } + + return o.Label +} + +// GetLabelOk returns a tuple with the Label field value +// and a boolean to check if the value has been set. +func (o *Scope) GetLabelOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Label, true +} + +// SetLabel sets field value +func (o *Scope) SetLabel(v string) { + o.Label = v +} + +// GetId returns the Id field value +func (o *Scope) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Scope) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Scope) SetId(v string) { + o.Id = v +} + +// GetTransient returns the Transient field value if set, zero value otherwise. +func (o *Scope) GetTransient() []string { + if o == nil || o.Transient == nil { + var ret []string + return ret + } + return o.Transient +} + +// GetTransientOk returns a tuple with the Transient field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Scope) GetTransientOk() ([]string, bool) { + if o == nil || o.Transient == nil { + return nil, false + } + return o.Transient, true +} + +// HasTransient returns a boolean if a field has been set. +func (o *Scope) HasTransient() bool { + if o != nil && o.Transient != nil { + return true + } + + return false +} + +// SetTransient gets a reference to the given []string and assigns it to the Transient field. +func (o *Scope) SetTransient(v []string) { + o.Transient = v +} + +func (o Scope) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["label"] = o.Label + } + if true { + toSerialize["id"] = o.Id + } + if o.Transient != nil { + toSerialize["transient"] = o.Transient + } + return json.Marshal(toSerialize) +} + +type NullableScope struct { + value *Scope + isSet bool +} + +func (v NullableScope) Get() *Scope { + return v.value +} + +func (v *NullableScope) Set(val *Scope) { + v.value = val + v.isSet = true +} + +func (v NullableScope) IsSet() bool { + return v.isSet +} + +func (v *NullableScope) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableScope(val *Scope) *NullableScope { + return &NullableScope{value: val, isSet: true} +} + +func (v NullableScope) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableScope) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/pkg/client/model_scope_all_of.go b/pkg/client/model_scope_all_of.go new file mode 100644 index 0000000..bc801cb --- /dev/null +++ b/pkg/client/model_scope_all_of.go @@ -0,0 +1,144 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +import ( + "encoding/json" +) + +// ScopeAllOf struct for ScopeAllOf +type ScopeAllOf struct { + Id string `json:"id"` + Transient []string `json:"transient,omitempty"` +} + +// NewScopeAllOf instantiates a new ScopeAllOf 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 NewScopeAllOf(id string) *ScopeAllOf { + this := ScopeAllOf{} + this.Id = id + return &this +} + +// NewScopeAllOfWithDefaults instantiates a new ScopeAllOf 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 NewScopeAllOfWithDefaults() *ScopeAllOf { + this := ScopeAllOf{} + return &this +} + +// GetId returns the Id field value +func (o *ScopeAllOf) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ScopeAllOf) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ScopeAllOf) SetId(v string) { + o.Id = v +} + +// GetTransient returns the Transient field value if set, zero value otherwise. +func (o *ScopeAllOf) GetTransient() []string { + if o == nil || o.Transient == nil { + var ret []string + return ret + } + return o.Transient +} + +// GetTransientOk returns a tuple with the Transient field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScopeAllOf) GetTransientOk() ([]string, bool) { + if o == nil || o.Transient == nil { + return nil, false + } + return o.Transient, true +} + +// HasTransient returns a boolean if a field has been set. +func (o *ScopeAllOf) HasTransient() bool { + if o != nil && o.Transient != nil { + return true + } + + return false +} + +// SetTransient gets a reference to the given []string and assigns it to the Transient field. +func (o *ScopeAllOf) SetTransient(v []string) { + o.Transient = v +} + +func (o ScopeAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["id"] = o.Id + } + if o.Transient != nil { + toSerialize["transient"] = o.Transient + } + return json.Marshal(toSerialize) +} + +type NullableScopeAllOf struct { + value *ScopeAllOf + isSet bool +} + +func (v NullableScopeAllOf) Get() *ScopeAllOf { + return v.value +} + +func (v *NullableScopeAllOf) Set(val *ScopeAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableScopeAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableScopeAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableScopeAllOf(val *ScopeAllOf) *NullableScopeAllOf { + return &NullableScopeAllOf{value: val, isSet: true} +} + +func (v NullableScopeAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableScopeAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/pkg/client/model_scope_options.go b/pkg/client/model_scope_options.go new file mode 100644 index 0000000..5d677eb --- /dev/null +++ b/pkg/client/model_scope_options.go @@ -0,0 +1,108 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +import ( + "encoding/json" +) + +// ScopeOptions struct for ScopeOptions +type ScopeOptions struct { + Label string `json:"label"` +} + +// NewScopeOptions instantiates a new ScopeOptions 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 NewScopeOptions(label string) *ScopeOptions { + this := ScopeOptions{} + this.Label = label + return &this +} + +// NewScopeOptionsWithDefaults instantiates a new ScopeOptions 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 NewScopeOptionsWithDefaults() *ScopeOptions { + this := ScopeOptions{} + return &this +} + +// GetLabel returns the Label field value +func (o *ScopeOptions) GetLabel() string { + if o == nil { + var ret string + return ret + } + + return o.Label +} + +// GetLabelOk returns a tuple with the Label field value +// and a boolean to check if the value has been set. +func (o *ScopeOptions) GetLabelOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Label, true +} + +// SetLabel sets field value +func (o *ScopeOptions) SetLabel(v string) { + o.Label = v +} + +func (o ScopeOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["label"] = o.Label + } + return json.Marshal(toSerialize) +} + +type NullableScopeOptions struct { + value *ScopeOptions + isSet bool +} + +func (v NullableScopeOptions) Get() *ScopeOptions { + return v.value +} + +func (v *NullableScopeOptions) Set(val *ScopeOptions) { + v.value = val + v.isSet = true +} + +func (v NullableScopeOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableScopeOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableScopeOptions(val *ScopeOptions) *NullableScopeOptions { + return &NullableScopeOptions{value: val, isSet: true} +} + +func (v NullableScopeOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableScopeOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/pkg/client/response.go b/pkg/client/response.go new file mode 100644 index 0000000..1c6d02a --- /dev/null +++ b/pkg/client/response.go @@ -0,0 +1,47 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +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 APIResponse 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/pkg/client/utils.go b/pkg/client/utils.go new file mode 100644 index 0000000..7daa2c5 --- /dev/null +++ b/pkg/client/utils.go @@ -0,0 +1,328 @@ +/* +Auth API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: AUTH_VERSION +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authclient + +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/swagger.yaml b/swagger.yaml index a3daf57..5e9f340 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -288,6 +288,8 @@ components: type: array items: type: string + required: + - id ScopeOptions: type: object properties: