Created
July 22, 2013 00:55
-
-
Save adammw/6050626 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "playlist4content.proto"; | |
import "playlist4issues.proto"; | |
import "playlist4meta.proto"; | |
import "playlist4ops.proto"; | |
package spotify.playlist4.proto; | |
option optimize_for = SPEED; | |
option java_package = "com.spotify.playlist4.proto"; | |
message ChangeInfo { | |
optional string user = 1; | |
optional int32 timestamp = 2; | |
optional bool admin = 3; | |
optional bool undo = 4; | |
optional bool redo = 5; | |
optional bool merge = 6; | |
optional bool compressed = 7; | |
optional bool migration = 8; | |
} | |
message Delta { | |
optional bytes base_version = 1; | |
repeated Op ops = 2; | |
optional ChangeInfo info = 4; | |
} | |
message Merge { | |
optional bytes base_version = 1; | |
optional bytes merge_version = 2; | |
optional ChangeInfo info = 4; | |
} | |
message ChangeSet { | |
enum Kind { | |
KIND_UNKNOWN = 0; | |
DELTA = 2; | |
MERGE = 3; | |
}; | |
required Kind kind = 1; | |
optional Delta delta = 2; | |
optional Merge merge = 3; | |
} | |
message RevisionTaggedChangeSet { | |
required bytes revision = 1; | |
required ChangeSet change_set = 2; | |
} | |
message Diff { | |
required bytes from_revision = 1; | |
repeated Op ops = 2; | |
required bytes to_revision = 3; | |
} | |
message ListDump { | |
optional bytes latestRevision = 1; | |
optional int32 length = 2; | |
optional ListAttributes attributes = 3; | |
optional ListChecksum checksum = 4; | |
optional ListItems contents = 5; | |
repeated Delta pendingDeltas = 7; | |
} | |
message ListChanges { | |
optional bytes baseRevision = 1; | |
repeated Delta deltas = 2; | |
optional bool wantResultingRevisions = 3; | |
optional bool wantSyncResult = 4; | |
optional ListDump dump = 5; | |
repeated int32 nonces = 6; | |
} | |
message SelectedListContent { | |
optional bytes revision = 1; | |
optional int32 length = 2; | |
optional ListAttributes attributes = 3; | |
optional ListChecksum checksum = 4; | |
optional ListItems contents = 5; | |
optional Diff diff = 6; | |
optional Diff syncResult = 7; | |
repeated bytes resultingRevisions = 8; | |
optional bool multipleHeads = 9; | |
optional bool upToDate = 10; | |
repeated ClientResolveAction resolveAction = 12; | |
repeated ClientIssue issues = 13; | |
repeated int32 nonces = 14; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "playlist4meta.proto"; | |
import "playlist4issues.proto"; | |
package spotify.playlist4.proto; | |
option optimize_for = SPEED; | |
option java_package = "com.spotify.playlist4.proto"; | |
message Item { | |
required string uri = 1; | |
optional ItemAttributes attributes = 2; | |
} | |
message ListItems { | |
required int32 pos = 1; | |
required bool truncated = 2; | |
repeated Item items = 3; | |
} | |
message ContentRange { | |
required int32 pos = 1; | |
optional int32 length = 2; | |
} | |
message ListContentSelection { | |
optional bool wantRevision = 1; | |
optional bool wantLength = 2; | |
optional bool wantAttributes = 3; | |
optional bool wantChecksum = 4; | |
optional bool wantContent = 5; | |
optional ContentRange contentRange = 6; | |
optional bool wantDiff = 7; | |
optional bytes baseRevision = 8; | |
optional bytes hintRevision = 9; | |
optional bool wantNothingIfUpToDate = 10; | |
optional bool wantResolveAction = 12; | |
repeated ClientIssue issues = 13; | |
repeated ClientResolveAction resolveAction = 14; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package spotify.playlist4.proto; | |
option optimize_for = SPEED; | |
option java_package = "com.spotify.playlist4.proto"; | |
message ClientIssue { | |
enum Level { | |
LEVEL_UNKNOWN = 0; | |
LEVEL_DEBUG = 1; | |
LEVEL_INFO = 2; | |
LEVEL_NOTICE = 3; | |
LEVEL_WARNING = 4; | |
LEVEL_ERROR = 5; | |
} | |
enum Code { | |
CODE_UNKNOWN = 0; | |
CODE_INDEX_OUT_OF_BOUNDS = 1; | |
CODE_VERSION_MISMATCH = 2; | |
CODE_CACHED_CHANGE = 3; | |
CODE_OFFLINE_CHANGE = 4; | |
CODE_CONCURRENT_CHANGE = 5; | |
} | |
optional Level level = 1; | |
optional Code code = 2; | |
optional int32 repeatCount = 3; | |
} | |
message ClientResolveAction { | |
enum Code { | |
CODE_UNKNOWN = 0; | |
CODE_NO_ACTION = 1; | |
CODE_RETRY = 2; | |
CODE_RELOAD = 3; | |
CODE_DISCARD_LOCAL_CHANGES = 4; | |
CODE_SEND_DUMP = 5; | |
CODE_DISPLAY_ERROR_MESSAGE = 6; | |
} | |
enum Initiator { | |
INITIATOR_UNKNOWN = 0; | |
INITIATOR_SERVER = 1; | |
INITIATOR_CLIENT = 2; | |
} | |
optional Code code = 1; | |
optional Initiator initiator = 2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package spotify.playlist4.proto; | |
option optimize_for = SPEED; | |
option java_package = "com.spotify.playlist4.proto"; | |
message ListChecksum { | |
required int32 version = 1; | |
optional bytes sha1 = 4; | |
} | |
message DownloadFormat { | |
enum Codec { | |
CODEC_UNKNOWN = 0; | |
OGG_VORBIS = 1; | |
FLAC = 2; | |
MPEG_1_LAYER_3 = 3; | |
} | |
required Codec codec = 1; | |
} | |
enum ListAttributeKind { | |
LIST_UNKNOWN = 0; | |
LIST_NAME = 1; | |
LIST_DESCRIPTION = 2; | |
LIST_PICTURE = 3; | |
LIST_COLLABORATIVE = 4; | |
LIST_PL3_VERSION = 5; | |
LIST_DELETED_BY_OWNER = 6; | |
LIST_RESTRICTED_COLLABORATIVE = 7; | |
} | |
message ListAttributes { | |
optional string name = 1; | |
optional string description = 2; | |
optional bytes picture = 3; | |
optional bool collaborative = 4; | |
optional string pl3_version = 5; | |
optional bool deleted_by_owner = 6; | |
optional bool restricted_collaborative = 7; | |
} | |
enum ItemAttributeKind { | |
ITEM_UNKNOWN = 0; | |
ITEM_ADDED_BY = 1; | |
ITEM_TIMESTAMP = 2; | |
ITEM_MESSAGE = 3; | |
ITEM_SEEN = 4; | |
ITEM_DOWNLOAD_COUNT = 5; | |
ITEM_DOWNLOAD_FORMAT = 6; | |
ITEM_SEVENDIGITAL_ID = 7; | |
ITEM_SEVENDIGITAL_LEFT = 8; | |
ITEM_SEEN_AT = 9; | |
} | |
message ItemAttributes { | |
optional string added_by = 1; | |
optional string message = 3; | |
optional bool seen = 4; | |
optional DownloadFormat download_format = 6; | |
optional string sevendigital_id = 7; | |
} | |
message StringAttribute { | |
required string key = 1; | |
required string value = 2; | |
} | |
message StringAttributes { | |
repeated StringAttribute attribute = 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "playlist4content.proto"; | |
import "playlist4meta.proto"; | |
package spotify.playlist4.proto; | |
option optimize_for = SPEED; | |
option java_package = "com.spotify.playlist4.proto"; | |
message Add { | |
optional int32 fromIndex = 1; | |
repeated Item items = 2; | |
optional ListChecksum list_checksum = 3; | |
optional bool addLast = 4; | |
optional bool addFirst = 5; | |
} | |
message Rem { | |
optional int32 fromIndex = 1; | |
optional int32 length = 2; | |
repeated Item items = 3; | |
optional ListChecksum list_checksum = 4; | |
optional ListChecksum items_checksum = 5; | |
optional ListChecksum uris_checksum = 6; | |
optional bool itemsAsKey = 7; | |
} | |
message Mov { | |
required int32 fromIndex = 1; | |
required int32 length = 2; | |
required int32 toIndex = 3; | |
optional ListChecksum list_checksum = 4; | |
optional ListChecksum items_checksum = 5; | |
optional ListChecksum uris_checksum = 6; | |
} | |
message ItemAttributesPartialState { | |
required ItemAttributes values = 1; | |
repeated ItemAttributeKind no_value = 2; | |
} | |
message ListAttributesPartialState { | |
required ListAttributes values = 1; | |
repeated ListAttributeKind no_value = 2; | |
} | |
message UpdateItemAttributes { | |
required int32 index = 1; | |
required ItemAttributesPartialState new_attributes = 2; | |
optional ItemAttributesPartialState old_attributes = 3; | |
optional ListChecksum list_checksum = 4; | |
optional ListChecksum old_attributes_checksum = 5; | |
} | |
message UpdateListAttributes { | |
required ListAttributesPartialState new_attributes = 1; | |
optional ListAttributesPartialState old_attributes = 2; | |
optional ListChecksum list_checksum = 3; | |
optional ListChecksum old_attributes_checksum = 4; | |
} | |
message Op { | |
enum Kind { | |
KIND_UNKNOWN = 0; | |
ADD = 2; | |
REM = 3; | |
MOV = 4; | |
UPDATE_ITEM_ATTRIBUTES = 5; | |
UPDATE_LIST_ATTRIBUTES = 6; | |
}; | |
required Kind kind = 1; | |
optional Add add = 2; | |
optional Rem rem = 3; | |
optional Mov mov = 4; | |
optional UpdateItemAttributes update_item_attributes = 5; | |
optional UpdateListAttributes update_list_attributes = 6; | |
} | |
message OpList { | |
repeated Op ops = 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'); | |
var ProtoBuf = require('protobufjs'); | |
var protoPath = path.resolve(__dirname); | |
var protoFiles = ['playlist4meta', 'playlist4issues', 'playlist4ops', 'playlist4content', 'playlist4changes']; | |
for (var i in protoFiles) { | |
var protoFile = protoFiles[i]; | |
console.log('Loading %s...', protoFile); | |
var builder = ProtoBuf.protoFromFile(protoFile + '.proto'); | |
console.log(protoFile, builder); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment