Пример #1
0
        public async Task ExportAsync(ISyncService sync, SyncOptions options, ISession session)
        {
            var model = new AssetFoldersModel
            {
                Paths = new List <string>()
            };

            async Task QueryAsync(string id)
            {
                var node = await sync.Folders.GetByIdAsync(id, true);

                foreach (var child in node?.Children?.Values ?? Enumerable.Empty <FolderNode>())
                {
                    model.Paths.Add(child.Path);

                    await QueryAsync(child.Id);
                }
            }

            await log.DoSafeAsync("Exporting folders", async() =>
            {
                await QueryAsync(FolderNode.RootId);
            });

            await sync.WriteWithSchema(new FilePath("assetFolders/assetFolders.json"), model, Ref);
        }
Пример #2
0
        public async Task GenerateSchemaAsync(ISyncService sync)
        {
            await sync.WriteJsonSchemaAsync <AssetFoldersModel>(new FilePath("assetFolders.json"));

            var sample = new AssetFoldersModel
            {
                Paths = new List <string>
                {
                    "images",
                    "documents",
                    "videos"
                }
            };

            await sync.WriteWithSchema(new FilePath("assetFolders", "__assetFolder.json"), sample, Ref);
        }