コード例 #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetFolderResponse response = new GetFolderResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("CustomMetadata", targetDepth))
                {
                    var unmarshaller = new DictionaryUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
                    response.CustomMetadata = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Metadata", targetDepth))
                {
                    var unmarshaller = FolderMetadataUnmarshaller.Instance;
                    response.Metadata = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
コード例 #2
0
        public static PostFolderRequest ToPostRequest(this GetFolderResponse response)
        {
            var model = MapFolderModel(response);

            return(new PostFolderRequest {
                Data = model
            });
        }
コード例 #3
0
        public static PutFolderRequest ToPutRequest(this GetFolderResponse response)
        {
            var model = MapFolderModel(response);

            return(new PutFolderRequest {
                Data = model, Id = response.Data.Id
            });
        }
コード例 #4
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetFolderResponse response = new GetFolderResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("commitId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.CommitId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("files", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <File, FileUnmarshaller>(FileUnmarshaller.Instance);
                    response.Files = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("folderPath", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.FolderPath = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("subFolders", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Folder, FolderUnmarshaller>(FolderUnmarshaller.Instance);
                    response.SubFolders = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("subModules", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <SubModule, SubModuleUnmarshaller>(SubModuleUnmarshaller.Instance);
                    response.SubModules = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("symbolicLinks", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <SymbolicLink, SymbolicLinkUnmarshaller>(SymbolicLinkUnmarshaller.Instance);
                    response.SymbolicLinks = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("treeId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.TreeId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
コード例 #5
0
        private static SaveFolderModel MapFolderModel(GetFolderResponse response)
        {
            var model = new SaveFolderModel
            {
                Version        = response.Data.Version,
                Title          = response.Data.Title,
                IsArchived     = response.Data.IsArchived,
                ParentFolderId = response.Data.ParentFolderId,
                Type           = response.Data.Type
            };

            return(model);
        }
コード例 #6
0
        public static GetFolderResponse Unmarshall(UnmarshallerContext context)
        {
            GetFolderResponse getFolderResponse = new GetFolderResponse();

            getFolderResponse.HttpResponse = context.HttpResponse;
            getFolderResponse.RequestId    = context.StringValue("GetFolder.RequestId");

            GetFolderResponse.GetFolder_Folder folder = new GetFolderResponse.GetFolder_Folder();
            folder.FolderId          = context.LongValue("GetFolder.Folder.FolderId");
            folder.Path              = context.StringValue("GetFolder.Folder.Path");
            getFolderResponse.Folder = folder;

            return(getFolderResponse);
        }
コード例 #7
0
        public static GetFolderResponse Unmarshall(UnmarshallerContext context)
        {
            GetFolderResponse getFolderResponse = new GetFolderResponse();

            getFolderResponse.HttpResponse   = context.HttpResponse;
            getFolderResponse.RequestId      = context.StringValue("GetFolder.RequestId");
            getFolderResponse.Success        = context.BooleanValue("GetFolder.Success");
            getFolderResponse.ErrorCode      = context.StringValue("GetFolder.ErrorCode");
            getFolderResponse.ErrorMessage   = context.StringValue("GetFolder.ErrorMessage");
            getFolderResponse.HttpStatusCode = context.IntegerValue("GetFolder.HttpStatusCode");

            GetFolderResponse.GetFolder_Data data = new GetFolderResponse.GetFolder_Data();
            data.FolderId          = context.StringValue("GetFolder.Data.FolderId");
            data.FolderPath        = context.StringValue("GetFolder.Data.FolderPath");
            getFolderResponse.Data = data;

            return(getFolderResponse);
        }
コード例 #8
0
ファイル: MediaExtensions.cs プロジェクト: k4gdw/BetterCMS
 private static SaveFolderModel MapFolderModel(GetFolderResponse response)
 {
     var model = new SaveFolderModel
                     {
                         Version = response.Data.Version,
                         Title = response.Data.Title,
                         IsArchived = response.Data.IsArchived,
                         ParentFolderId = response.Data.ParentFolderId,
                         Type = response.Data.Type
                     };
     return model;
 }