syntax = "proto2";

message Credential {
    optional string facebook_uid = 0x1;
    optional string access_token = 0x2;
}

message EnableRequest {
    optional Credential credential = 0x1;
}

message EnableReply {
    optional Credential credential = 0x1;
}

message DisableRequest {
    optional Credential credential = 0x1;
}

message RevokeRequest {
    optional Credential credential = 0x1;
}

message InspectCredentialRequest {
    optional Credential credential = 0x1;
}

message InspectCredentialReply {
    optional Credential alternative_credential = 0x1;
    optional bool app_user = 0x2;
    optional bool permanent_error = 0x3;
    optional bool transient_error = 0x4;
}

message UserState {
    optional Credential credential = 0x1;
}

message UpdateUserStateRequest {
    optional Credential credential = 0x1;
}

message OpenGraphError {
    repeated string permanent = 0x1;
    repeated string invalid_token = 0x2;
    repeated string retries = 0x3;
}

message OpenGraphScrobble {
    optional int32 create_delay = 0x1;
}

message OpenGraphConfig {
    optional OpenGraphError error = 0x1;
    optional OpenGraphScrobble scrobble = 0x2;
}

message AuthConfig {
    optional string url = 0x1;
    repeated string permissions = 0x2;
    repeated string blacklist = 0x3;
    repeated string whitelist = 0x4;
    repeated string cancel = 0x5;
}

message ConfigReply {
    optional string domain = 0x1;
    optional string app_id = 0x2;
    optional string app_namespace = 0x3;
    optional AuthConfig auth = 0x4;
    optional OpenGraphConfig og = 0x5;
}

message UserFields {
    optional bool app_user = 0x1;
    optional bool display_name = 0x2;
    optional bool first_name = 0x3;
    optional bool middle_name = 0x4;
    optional bool last_name = 0x5;
    optional bool picture_large = 0x6;
    optional bool picture_square = 0x7;
    optional bool gender = 0x8;
    optional bool email = 0x9;
}

message UserOptions {
    optional bool cache_is_king = 0x1;
}

message UserRequest {
    optional UserOptions options = 0x1;
    optional UserFields fields = 0x2;
}

message User {
    optional string spotify_username = 0x1;
    optional string facebook_uid = 0x2;
    optional bool app_user = 0x3;
    optional string display_name = 0x4;
    optional string first_name = 0x5;
    optional string middle_name = 0x6;
    optional string last_name = 0x7;
    optional string picture_large = 0x8;
    optional string picture_square = 0x9;
    optional string gender = 0xa;
    optional string email = 0xb;
}

message FriendsFields {
    optional bool app_user = 0x1;
    optional bool display_name = 0x2;
    optional bool picture_large = 0x6;
}

message FriendsOptions {
    optional int32 limit = 0x1;
    optional int32 offset = 0x2;
    optional bool cache_is_king = 0x3;
    optional bool app_friends = 0x4;
    optional bool non_app_friends = 0x5;
}

message FriendsRequest {
    optional FriendsOptions options = 0x1;
    optional FriendsFields fields = 0x2;
}

message FriendsReply {
    repeated User friends = 0x1;
    optional bool more = 0x2;
}

message ShareRequest {
    optional Credential credential = 0x1;
    optional string uri = 0x2;
    optional string message_text = 0x3;
}

message ShareReply {
    optional string post_id = 0x1;
}

message InboxRequest {
    optional Credential credential = 0x1;
    repeated string facebook_uids = 0x3;
    optional string message_text = 0x4;
    optional string message_link = 0x5;
}

message InboxReply {
    optional string message_id = 0x1;
    optional string thread_id = 0x2;
}

message PermissionsOptions {
    optional bool cache_is_king = 0x1;
}

message PermissionsRequest {
    optional Credential credential = 0x1;
    optional PermissionsOptions options = 0x2;
}

message PermissionsReply {
    repeated string permissions = 0x1;
}

message GrantPermissionsRequest {
    optional Credential credential = 0x1;
    repeated string permissions = 0x2;
}

message GrantPermissionsReply {
    repeated string granted = 0x1;
    repeated string failed = 0x2;
}

message TransferRequest {
    optional Credential credential = 0x1;
    optional string source_username = 0x2;
    optional string target_username = 0x3;
}

