syntax = "proto3"; import "validate/validate.proto"; package userApi; option go_package = "github.com/onlicorp/user-tray/userApi/gen"; message Identity { // usr-agent string onli_you_id = 1; string created_by_app = 2; string agent = 3; // app-user string email_invite = 4; // end-user string first_name = 5; string alt_name = 6; string last_name = 7; string email = 8; string alt_email = 9; string username = 10; string address = 11; string address_2 = 12; string city = 13; string state = 14; string postal = 15; string country = 16; string phone = 17; string company = 18; // admin Status status = 20; // security string gene_id = 21; string gene_location = 22; string proof_id = 23; string linked_id = 24; // optional for linking masters to users } message Context { // app-user string registra = 1; // security Location restrict_location = 2; // usr-agent string user_role = 3; // logistics/vault-oracle map vault_ids = 4; // security string current_auth_key = 5; // app-user map appliances = 6 [(validate.rules).map = { keys: { string : { pattern:"[A-Z]{2,5}", } }, }]; // security repeated string allowed_methods = 7; } message ExternalUser { // ExternalUser is a User without db_id // usr-agent string patent_notice = 1; int64 created_at = 2; int64 updated_at = 3; Identity identity = 4; ExternalContent content = 5; Context context = 6; } // Special models message LimitedIdentity { // usr-agent string onli_you_id = 1; // end-user string first_name = 2; string alt_name = 3; string last_name = 4; string email = 5; string alt_email = 6; string username = 7; string address = 8; string address_2 = 9; string city = 10; string state = 11; string postal = 12; string country = 13; string phone = 14; string company = 15; // admin Status status = 16; } message ExternalContent { // end-user string profile_img = 1; // usr-agent string recover_code = 2; string hash_story = 3; string my_use_policy = 4; // logistics/vault-oracle Location core_location = 5; string core_ip_address = 6; string core_vault_id = 7; string core_device_id = 8; string mobile_device_id = 9; string mobile_vault_id = 10; string desktop_device_id = 11; string desktop_vault_id = 12; string cloud_device_id = 13; string cloud_vault_id = 14; map locker_device_ids = 15; map locker_vault_ids = 16; // onli-os string description = 17; string depict = 18; string derive = 19; repeated string subjects = 20; repeated string objects = 21; repeated string stacks = 22; repeated string collections = 23; repeated string use_policies = 24; // end-user string pmt_method = 25; string pmt_account_name = 26; string pmt_account_number = 27; // usr-agent map my_appliances = 29 [(validate.rules).map = { keys: { string : { pattern:"[A-Z]{2,5}", } }, }]; } enum Status { STATUS_NIL = 0; STATUS_RESERVE = 1; STATUS_INVITED = 2; STATUS_ACTIVE = 3; STATUS_INACTIVE = 4; STATUS_BUILT = 5; } enum app_status { STATUS_APP_NIL = 0; STATUS_APP_INACTIVE = 1; STATUS_APP_ACTIVE = 2; } message my_appliance { app_status status = 1; string profile_img = 2; string name = 3; string email = 4; string address = 5; string handle = 6; string master_id = 7; // optional for linking users to masters } message Location { float latitude = 1; float longitude = 2; } message appliance { string user_class = 1; app_status status = 2; string extra = 3; } message LimitedContent { string profile_img = 1; map my_appliances = 2 [(validate.rules).map = { keys: { string : { pattern:"[A-Z]{2,5}", } }, }]; } message AppliancesContext { map appliances = 1 [(validate.rules).map = { keys: { string : { pattern:"[A-Z]{2,5}", } }, }]; } message CreateContextReq { map appliances = 1 [(validate.rules).map = { keys: { string : { pattern:"[A-Z]{2,5}", } }, }]; repeated string allowed_methods = 2; } message LimitedUser { LimitedIdentity identity = 1; LimitedContent content = 2; AppliancesContext context = 3; } message IdentityOnliId { string onli_you_id = 1 [(validate.rules).string.min_len=1]; } message IdentityResponse { uint32 status = 1; IdentityOnliId identity = 2; } message SuccessResponse { uint32 status = 1; bool success = 2; } /** create **/ message CreateRequest { message Data { CreateIdentityReq identity = 2 [(validate.rules).message.required=true]; CreateContextReq context = 3 [(validate.rules).message.required=true]; } Data data = 1 [(validate.rules).message.required=true]; } message CreateIdentityReq { string onli_you_id = 1; // optional for pre-minted users. If left empty, user-tray will mint internally string email = 2 [(validate.rules).string.email=true]; string phone = 3; } message Meta { int32 limit = 1; int32 offset = 2; string order_by = 3; bool ascending = 4; string keyword = 5; } message AppSymReq { string onli_you_id = 1 [(validate.rules).string.min_len=1]; string app_symbol = 2 [(validate.rules).string.pattern="[A-Z]{2,5}"]; } message AskToAddOwnerRecord { string onli_you_id = 1 [(validate.rules).string.min_len=1]; string ask_to_add_owner_id = 2 [(validate.rules).string.min_len=1]; string app_symbol = 3 [(validate.rules).string.pattern="[A-Z]{2,5}"]; } /** verify **/ message VerifyYouReq { string app_symbol = 1 [(validate.rules).string.pattern="[A-Z]{2,5}"]; string email = 2 [(validate.rules).string.email=true]; string email_invite = 3 [(validate.rules).string.len=6]; } message VerifyYouResponse { string onli_you_id = 1; }