예제 #1
0
        public async Task OnExecute(CommandLineApplication app)
        {
            var showDoc = (await _showDocStore.GetAll()).FirstOrDefault(x => x.Name == Name);

            if (showDoc == null)
            {
                Console.WriteLine($"Not Found Project {Name}");
                return;
            }

            try
            {
                var docStr = await HttpClient.GetStringAsync(showDoc.SwaggerUrl);

                var document = SwaggerParser.ParseString(docStr);
                var request  = document.ToShowDocRequest();

                foreach (var item in request)
                {
                    await ShowDocClient.UpdateByApi(showDoc, item);
                }

                Console.WriteLine("Sync Successfully!");
            }
            catch (Exception e)
            {
                Console.WriteLine($"Sync failed: {e.StackTrace}");
            }
        }
예제 #2
0
        public async Task OnExecute(CommandLineApplication app)
        {
            if ((await _showDocStore.GetAll()).Any(x => x.Name == Name))
            {
                Console.WriteLine($"Project {Name} already exists");
                return;
            }
            await _showDocStore.AddShowDoc(new ShowDocEntity
            {
                AppKey     = ApiKey,
                AppToken   = ApiToken,
                Name       = Name,
                ShowDocUrl = ShowDocUrl,
                SwaggerUrl = SwaggerUrl
            });

            Console.WriteLine("Add done...");
        }
예제 #3
0
        public async Task OnExecute(CommandLineApplication app)
        {
            var showDoc = (await _showDocStore.GetAll()).FirstOrDefault(x => x.Name == Name);

            if (showDoc == null)
            {
                Console.WriteLine($"Not Found Project {Name}");
                return;
            }

            showDoc.Name       = Name;
            showDoc.AppKey     = ApiKey;
            showDoc.AppToken   = ApiToken;
            showDoc.ShowDocUrl = ShowDocUrl;
            showDoc.SwaggerUrl = SwaggerUrl;

            await _showDocStore.UpdateShowDoc(showDoc);

            Console.WriteLine("Update Success");
        }
예제 #4
0
        public async Task OnExecute(CommandLineApplication app)
        {
            var result = await _showDocStore.GetAll();

            if (result.Any())
            {
                foreach (var docEntity in result)
                {
                    Console.WriteLine(docEntity.Name);
                    Console.WriteLine($"-------- Id : {docEntity.Id}");
                    Console.WriteLine($"-------- Name : {docEntity.Name}");
                    Console.WriteLine($"-------- ApiKey : {docEntity.AppKey}");
                    Console.WriteLine($"-------- ApiToken : {docEntity.AppToken}");
                    Console.WriteLine($"-------- SwaggerUrl : {docEntity.SwaggerUrl}");
                    Console.WriteLine($"-------- ShowDocUrl : {docEntity.ShowDocUrl}");
                }
            }
            else
            {
                Console.WriteLine("No items exist");
            }
        }