{"consumes":["application/json"],"produces":["application/json"],"schemes":["http"],"swagger":"2.0","info":{"description":"Responsible for maintaining platform users and accounts.","version":"0.1","title":"A3s-API"},"host":"localhost:8080","basePath":"/","paths":{"/users/":{"post":{"tags":["Users"],"summary":"Create New User.","operationId":"CreateUserRequest","parameters":[{"name":"Body","in":"body","schema":{"$ref":"#/definitions/CreateUserRequest"}}],"responses":{"201":{"$ref":"#/responses/CreateUser201"},"400":{"description":"ValidationError","schema":{"$ref":"#/definitions/ValidationError"},"examples":{"application/json":{"status":{"code":3,"message":"VALIDATION_ERRORS: '1'","details":[{"@type":"type.googleapis.com/platformmodel.APIError","error_type":"TOO_LONG","error_message":"Length must be less than 5","path":"$.locale","validation_rules":{"length":{"max":"5"}}}]}}}},"409":{"description":"ConflictError","schema":{"$ref":"#/definitions/ConflictError"}},"500":{"description":"Error500","schema":{"$ref":"#/definitions/Error500"}}}},"put":{"tags":["Users"],"summary":"Update user if exists, otherwise it create new user.","operationId":"SetUserRequest","parameters":[{"name":"Body","in":"body","schema":{"$ref":"#/definitions/SetUserRequest"}}],"responses":{"200":{"$ref":"#/responses/SetUser200"},"400":{"description":"ValidationError","schema":{"$ref":"#/definitions/ValidationError"},"examples":{"application/json":{"status":{"code":3,"message":"VALIDATION_ERRORS: '1'","details":[{"@type":"type.googleapis.com/platformmodel.APIError","error_type":"TOO_LONG","error_message":"Length must be less than 5","path":"$.locale","validation_rules":{"length":{"max":"5"}}}]}}}},"500":{"description":"Error500","schema":{"$ref":"#/definitions/Error500"}}}}}},"definitions":{"Any":{"description":"Protobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.","type":"object","title":"`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.","properties":{"type_url":{"description":"A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message.","type":"string","x-go-name":"TypeUrl"},"value":{"description":"Must be a valid serialized protocol buffer of the above specified type.","type":"array","items":{"type":"integer","format":"uint8"},"x-go-name":"Value"}},"x-go-package":"google.golang.org/protobuf/types/known/anypb"},"CreateUserRequest":{"type":"object","properties":{"user_first_name":{"type":"string","example":"example"},"user_last_name":{"type":"string","example":"user"},"user_email":{"type":"string","example":"example@example.com"},"user_phone":{"type":"string","example":"88399334455"},"platform_accounts":{"type":"object","additionalProperties":{"type":"object"},"properties":{"0":{"$ref":"#/definitions/UserPlatformAccountRequest"}}},"require_2fa":{"type":"boolean"},"locale":{"type":"string","example":"br"},"email_verified":{"type":"boolean"}},"example":{"user_first_name":"test","user_last_name":"user","user_email":"example6@example.com","user_phone":"88399334455","platform_accounts":{"0":{"platform_account_id":342000000000006900,"role_name":"ADMIN"}},"require_2fa":false,"locale":"br","email_verified":false},"required":["user_email"],"x-go-package":"github.com/ResultadosDigitais/platform/a3s/cmd/a3sd/docs"},"SetUserRequest":{"type":"object","properties":{"key":{"$ref":"#/definitions/key"},"user_first_name":{"type":"string","example":"example"},"user_last_name":{"type":"string","example":"user"},"current_platform_account_id":{"type":"string","example":"894000000000000514"},"user_phone":{"type":"string","example":"88399334455"},"platform_accounts":{"type":"object","additionalProperties":{"type":"object"},"properties":{"0":{"$ref":"#/definitions/UserPlatformAccountRequest"}}},"require_2fa":{"type":"boolean"},"locale":{"type":"string","example":"br"},"email_verified":{"type":"boolean"}},"example":{"key":{"user_email":"example@example.com"},"user_first_name":"test first","user_last_name":"test last","user_phone":"88399334455","current_platform_account_id":"894000000000000514","require_2fa":false,"user_claims":{},"platform_accounts":{"0":{"platform_account_id":894000000000000500,"role_name":"SALES"}},"locale":"en","email_verified":false},"required":["key"],"x-go-package":"github.com/ResultadosDigitais/platform/a3s/cmd/a3sd/docs"},"CreateUser201":{"type":"object","properties":{"user":{"$ref":"#/definitions/UserResponse"}},"x-go-package":"github.com/ResultadosDigitais/platform/a3s/models/a3smodel"},"SetUser200":{"type":"object","properties":{"user":{"$ref":"#/definitions/UserResponse"}},"x-go-package":"github.com/ResultadosDigitais/platform/a3s/models/a3smodel"},"key":{"type":"object","properties":{"user_email":{"type":"string","example":"example@example.com"}}},"Status":{"description":"You can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors).","type":"object","title":"The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, Each `Status` message contains\nthree pieces of data: error code, error message, and error details.","properties":{"code":{"description":"The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].","type":"integer","format":"int32","x-go-name":"Code"},"details":{"description":"A list of messages that carry the error details.  There is a common set of\nmessage types for APIs to use.","type":"array","items":{"$ref":"#/definitions/Any"},"x-go-name":"Details"},"message":{"description":"A developer-facing error message, which should be in English.","type":"string","x-go-name":"Message"}},"x-go-package":"google.golang.org/genproto/googleapis/rpc/status"},"UserPlatformAccountRequest":{"type":"object","properties":{"platform_account_id":{"type":"integer","format":"int64","x-go-name":"PlatformAccountId"},"role_name":{"type":"string","x-go-name":"RoleName"}},"x-go-package":"github.com/ResultadosDigitais/platform/a3s/cmd/a3sd/docs"},"RoleFeatureRequest":{"type":"object","properties":{"can_read":{"type":"boolean","x-go-name":"CanRead"},"can_write":{"type":"boolean","x-go-name":"CanWrite"},"role_feature_name":{"type":"string","x-go-name":"RoleFeatureName"}},"x-go-package":"github.com/ResultadosDigitais/platform/a3s/cmd/a3sd/docs"},"RoleResponse":{"type":"object","properties":{"role_features":{"type":"array","items":{"$ref":"#/definitions/RoleFeatureRequest"},"x-go-name":"RoleFeatures"},"role_name":{"type":"string","x-go-name":"RoleName"}},"x-go-package":"github.com/ResultadosDigitais/platform/a3s/cmd/a3sd/docs"},"UserPlatformAccountResponse":{"type":"object","properties":{"country_code":{"type":"string","example":"br","x-go-name":"CountryCode"},"created_at":{"type":"string","format":"date-time","example":"2022-10-21T14:45:42.342703Z","x-go-name":"CreatedAt"},"platform_account_id":{"type":"integer","format":"int64","example":"342000000000006913","x-go-name":"PlatformAccountId"},"platform_account_name":{"type":"string","example":"some company","x-go-name":"PlatformAccountName"},"role_name":{"type":"string","example":"ADMIN","x-go-name":"RoleName"},"subscriptions":{"type":"object","additionalProperties":{"$ref":"#/definitions/UserServiceSubscriptionResponse"},"x-go-name":"Subscriptions"},"updated_at":{"type":"string","format":"date-time","example":"2022-10-21T14:45:42.342703Z","x-go-name":"UpdatedAt"}},"x-go-package":"github.com/ResultadosDigitais/platform/a3s/cmd/a3sd/docs"},"UserServiceSubscriptionResponse":{"type":"object","properties":{"active":{"description":"defined by testing the current timestamp with subscription valid_until attribute","type":"boolean","x-go-name":"Active"},"created_at":{"type":"string","format":"date-time","example":"2022-10-21T14:45:42.342703Z","x-go-name":"CreatedAt"},"plan_code":{"type":"string","example":"crm_free","x-go-name":"PlanCode"},"plan_name":{"type":"string","example":"Free","x-go-name":"PlanName"},"platform_service_code":{"type":"string","example":"crm","x-go-name":"PlatformServiceCode"},"platform_service_name":{"type":"string","example":"rd station CRM","x-go-name":"PlatformServiceName"},"role":{"$ref":"#/definitions/RoleResponse"},"status":{"type":"string","example":"ACTIVE","x-go-name":"Status"},"updated_at":{"type":"string","format":"date-time","x-go-name":"UpdatedAt"},"valid_until":{"type":"string","format":"date-time","example":"2023-01-02T15:04:05.999999Z","x-go-name":"ValidUntil"}},"x-go-package":"github.com/ResultadosDigitais/platform/a3s/cmd/a3sd/docs"},"UserResponse":{"type":"object","properties":{"user_id":{"type":"string","example":"701000000000006147"},"user_first_name":{"type":"string","example":"test"},"user_last_name":{"type":"string","example":"user"},"user_email":{"type":"string","example":"example2@example.com"},"user_phone":{"type":"string","example":"88399334455"},"created_at":{"type":"string","example":"2022-10-21T12:54:58.701185364Z"},"updated_at":{"type":"string","example":"2022-10-21T12:54:58.701185364Z"},"require_2fa":{"type":"boolean"},"locale":{"type":"string","example":"br"},"email_verified":{"type":"boolean"},"platform_accounts":{"description":"platform_acccounts contains the list of platform accounts available for this user\nkey is a platform_account_id","type":"object","additionalProperties":{"type":"object"},"properties":{"0":{"$ref":"#/definitions/UserPlatformAccountResponse"}},"x-go-package":"github.com/ResultadosDigitais/platform/a3s/models/a3smodel","x-go-name":"PlatformAccounts"},"user_claims":{"description":"user_claims is a list of custom attributes to be insert as claims into user JWT token","type":"object","additionalProperties":{"type":"object"},"x-go-name":"UserClaims"}},"example":{"user":{"user_id":"114000000000006915","user_first_name":"test","user_last_name":"user","user_email":"example6@example.com","user_phone":"88399334455","platform_accounts":{"342000000000006913":{"platform_account_id":"342000000000006913","platform_account_name":"yyyyyyy company","subscriptions":{"crm":{"platform_service_code":"crm","platform_service_name":"rd station CRM","plan_code":"crm_free","plan_name":"Free","role":{"role_name":"ADMIN","role_features":[{"role_feature_name":"common","can_read":true}]},"created_at":"2022-10-21T14:45:42.342938Z","updated_at":"2022-10-21T14:45:42.342938Z","active":true,"status":"ACTIVE","valid_until":"2023-01-02T15:04:05.999999Z"}},"created_at":"2022-10-21T14:45:42.342703Z","updated_at":"2022-10-21T14:45:42.342703Z","role_name":"ADMIN","country_code":"br"}},"created_at":"2022-10-21T14:46:06.114692812Z","updated_at":"2022-10-21T14:46:06.114692812Z","require_2fa":false,"locale":"br","email_verified":false}},"x-go-package":"github.com/ResultadosDigitais/platform/a3s/models/a3smodel"},"ValidationError":{"description":"Response returned when have validation error","type":"object","properties":{"status":{"$ref":"#/definitions/Status"}},"x-go-package":"github.com/ResultadosDigitais/platform/a3s/cmd/a3sd/docs"},"ConflictError":{"description":"Response returned when have conflict error","type":"object","properties":{"status":{"type":"object","properties":{"code":{"type":"integer","format":"int64","x-go-name":"Code","example":6},"message":{"type":"string","x-go-name":"Message","example":"entity already exists: app: \"dev~a3s-pubsub-project\"\npath <\n  Element {\n    type: \"emails\"\n    name: \"example4@example.com\"\n  }\n>\n"}},"x-go-name":"Status"}},"x-go-package":"github.com/ResultadosDigitais/platform/a3s/cmd/a3sd/docs"},"Error500":{"description":"Response returned when have conflict error","type":"object","properties":{"status":{"type":"object","properties":{"code":{"type":"integer","format":"int64","x-go-name":"Code","example":2},"message":{"type":"string","x-go-name":"Message","example":"backend is down"}},"x-go-name":"Status"}},"x-go-package":"github.com/ResultadosDigitais/platform/a3s/cmd/a3sd/docs"}},"responses":{"CreateUser201":{"description":"","schema":{"$ref":"#/definitions/CreateUser201"}},"SetUser200":{"description":"","schema":{"$ref":"#/definitions/SetUser200"}}}}