RelocationError enc.IEncodable <RelocationError> .Decode(enc.IDecoder decoder) { switch (decoder.GetUnionName()) { case "from_lookup": using (var obj = decoder.GetObject()) { return(new FromLookup(obj.GetFieldObject <LookupError>("from_lookup"))); } case "from_write": using (var obj = decoder.GetObject()) { return(new FromWrite(obj.GetFieldObject <WriteError>("from_write"))); } case "to": using (var obj = decoder.GetObject()) { return(new To(obj.GetFieldObject <WriteError>("to"))); } case "cant_copy_shared_folder": return(CantCopySharedFolder.Instance); case "cant_nest_shared_folder": return(CantNestSharedFolder.Instance); case "too_many_files": return(TooManyFiles.Instance); default: return(Other.Instance); } }
LinkMetadata enc.IEncodable <LinkMetadata> .Decode(enc.IDecoder decoder) { var tag = string.Empty; using (var obj = decoder.GetObject()) { tag = obj.GetField <string>(".tag"); } switch (tag) { case "path": var path = new PathLinkMetadata(); return(((enc.IEncodable <PathLinkMetadata>)path).Decode(decoder)); case "collection": var collection = new CollectionLinkMetadata(); return(((enc.IEncodable <CollectionLinkMetadata>)collection).Decode(decoder)); default: using (var obj = decoder.GetObject()) { this.Url = obj.GetField <string>("url"); this.Visibility = obj.GetFieldObject <Visibility>("visibility"); if (obj.HasField("expires")) { this.Expires = obj.GetField <sys.DateTime>("expires"); } } return(this); } }
WriteError enc.IEncodable <WriteError> .Decode(enc.IDecoder decoder) { switch (decoder.GetUnionName()) { case "malformed_path": using (var obj = decoder.GetObject()) { return(new MalformedPath(obj.GetField <string>("malformed_path"))); } case "conflict": using (var obj = decoder.GetObject()) { return(new Conflict(obj.GetFieldObject <WriteConflictError>("conflict"))); } case "no_write_permission": return(NoWritePermission.Instance); case "insufficient_space": return(InsufficientSpace.Instance); case "disallowed_name": return(DisallowedName.Instance); default: return(Other.Instance); } }
CommitInfo enc.IEncodable <CommitInfo> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Path = obj.GetField <string>("path"); if (obj.HasField("mode")) { this.Mode = obj.GetFieldObject <WriteMode>("mode"); } if (obj.HasField("autorename")) { this.Autorename = obj.GetField <bool>("autorename"); } if (obj.HasField("client_modified")) { this.ClientModified = obj.GetField <sys.DateTime>("client_modified"); } if (obj.HasField("mute")) { this.Mute = obj.GetField <bool>("mute"); } } return(this); }
LookupError enc.IEncodable <LookupError> .Decode(enc.IDecoder decoder) { switch (decoder.GetUnionName()) { case "malformed_path": using (var obj = decoder.GetObject()) { return(new MalformedPath(obj.GetField <string>("malformed_path"))); } case "not_found": return(NotFound.Instance); case "not_file": return(NotFile.Instance); case "not_folder": return(NotFolder.Instance); case "restricted_content": return(RestrictedContent.Instance); default: return(Other.Instance); } }
Metadata enc.IEncodable <Metadata> .Decode(enc.IDecoder decoder) { var tag = string.Empty; using (var obj = decoder.GetObject()) { tag = obj.GetField <string>(".tag"); } switch (tag) { case "file": var file = new FileMetadata(); return(((enc.IEncodable <FileMetadata>)file).Decode(decoder)); case "folder": var folder = new FolderMetadata(); return(((enc.IEncodable <FolderMetadata>)folder).Decode(decoder)); case "deleted": var deleted = new DeletedMetadata(); return(((enc.IEncodable <DeletedMetadata>)deleted).Decode(decoder)); default: throw new sys.InvalidOperationException(); } }
ListFolderContinueArg enc.IEncodable <ListFolderContinueArg> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Cursor = obj.GetField <string>("cursor"); } return(this); }
ListFolderGetLatestCursorResult enc.IEncodable <ListFolderGetLatestCursorResult> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Cursor = obj.GetField <string>("cursor"); } return(this); }
GetMetadataArg enc.IEncodable <GetMetadataArg> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Path = obj.GetField <string>("path"); } return(this); }
UploadSessionOffsetError enc.IEncodable <UploadSessionOffsetError> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.CorrectOffset = obj.GetField <ulong>("correct_offset"); } return(this); }
GetSharedLinksResult enc.IEncodable <GetSharedLinksResult> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Links = new col.List <LinkMetadata>(obj.GetFieldObjectList <LinkMetadata>("links")); } return(this); }
ListSharedFoldersResult enc.IEncodable <ListSharedFoldersResult> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Entries = new col.List <SharedFolderMetadata>(obj.GetFieldObjectList <SharedFolderMetadata>("entries")); } return(this); }
MembershipInfo enc.IEncodable <MembershipInfo> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.AccessType = obj.GetFieldObject <AccessType>("access_type"); } return(this); }
UploadSessionStartResult enc.IEncodable <UploadSessionStartResult> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.SessionId = obj.GetField <string>("session_id"); } return(this); }
IndividualSpaceAllocation enc.IEncodable <IndividualSpaceAllocation> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Allocated = obj.GetField <ulong>("allocated"); } return(this); }
GetAccountArg enc.IEncodable <GetAccountArg> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.AccountId = obj.GetField <string>("account_id"); } return(this); }
UploadWriteFailed enc.IEncodable <UploadWriteFailed> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Reason = obj.GetFieldObject <WriteError>("reason"); this.UploadSessionId = obj.GetField <string>("upload_session_id"); } return(this); }
ListRevisionsResult enc.IEncodable <ListRevisionsResult> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.IsDeleted = obj.GetField <bool>("is_deleted"); this.Entries = new col.List <FileMetadata>(obj.GetFieldObjectList <FileMetadata>("entries")); } return(this); }
RestoreArg enc.IEncodable <RestoreArg> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Path = obj.GetField <string>("path"); this.Rev = obj.GetField <string>("rev"); } return(this); }
Team enc.IEncodable <Team> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Id = obj.GetField <string>("id"); this.Name = obj.GetField <string>("name"); } return(this); }
RelocationArg enc.IEncodable <RelocationArg> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.FromPath = obj.GetField <string>("from_path"); this.ToPath = obj.GetField <string>("to_path"); } return(this); }
SpaceUsage enc.IEncodable <SpaceUsage> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Used = obj.GetField <ulong>("used"); this.Allocation = obj.GetFieldObject <SpaceAllocation>("allocation"); } return(this); }
Account enc.IEncodable <Account> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.AccountId = obj.GetField <string>("account_id"); this.Name = obj.GetFieldObject <Name>("name"); } return(this); }
SearchMatch enc.IEncodable <SearchMatch> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.MatchType = obj.GetFieldObject <SearchMatchType>("match_type"); this.Metadata = obj.GetFieldObject <Metadata>("metadata"); } return(this); }
UploadSessionFinishArg enc.IEncodable <UploadSessionFinishArg> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Cursor = obj.GetFieldObject <UploadSessionCursor>("cursor"); this.Commit = obj.GetFieldObject <CommitInfo>("commit"); } return(this); }
UploadSessionCursor enc.IEncodable <UploadSessionCursor> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.SessionId = obj.GetField <string>("session_id"); this.Offset = obj.GetField <ulong>("offset"); } return(this); }
DeletedMetadata enc.IEncodable <DeletedMetadata> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Name = obj.GetField <string>("name"); this.PathLower = obj.GetField <string>("path_lower"); } return(this); }
DeleteError enc.IEncodable <DeleteError> .Decode(enc.IDecoder decoder) { switch (decoder.GetUnionName()) { case "path_lookup": using (var obj = decoder.GetObject()) { return(new PathLookup(obj.GetFieldObject <LookupError>("path_lookup"))); } case "path_write": using (var obj = decoder.GetObject()) { return(new PathWrite(obj.GetFieldObject <WriteError>("path_write"))); } default: return(Other.Instance); } }
SpaceAllocation enc.IEncodable <SpaceAllocation> .Decode(enc.IDecoder decoder) { switch (decoder.GetUnionName()) { case "individual": using (var obj = decoder.GetObject()) { return(new Individual(obj.GetFieldObject <IndividualSpaceAllocation>("individual"))); } case "team": using (var obj = decoder.GetObject()) { return(new Team(obj.GetFieldObject <TeamSpaceAllocation>("team"))); } default: return(Other.Instance); } }
ListFolderResult enc.IEncodable <ListFolderResult> .Decode(enc.IDecoder decoder) { using (var obj = decoder.GetObject()) { this.Entries = new col.List <Metadata>(obj.GetFieldObjectList <Metadata>("entries")); this.Cursor = obj.GetField <string>("cursor"); this.HasMore = obj.GetField <bool>("has_more"); } return(this); }