public ActionResult AboutJson()
        {
            AboutJsonResponse jsonResponse = new AboutJsonResponse()
            {
                AppName         = "Pseudo Markets Unified API",
                AppVersion      = _config.Value.AppVersion,
                ServerId        = _config.Value.ServerId,
                Environment     = _config.Value.Environment,
                DataSyncEnabled = _config.Value.DataSyncEnabled,
                Copyright       = $"(c) 2019 - {DateTime.Now.Year} Pseudo Markets"
            };

            var response = JsonConvert.SerializeObject(jsonResponse);

            return(Ok(response));
        }
        public JsonResult Get()
        {
            AboutJsonResponse json = new AboutJsonResponse();

            json.custumer            = new Custumer();
            json.custumer.host       = DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds.ToString();
            json.server              = new Server();
            json.server.current_time = DateTime.Now.TimeOfDay.TotalSeconds;
            json.server.services     = new List <Services>();
            Services services = new Services();

            services.name    = "Weather";
            services.widgets = new List <Widgets>();
            Widgets widgets = new Widgets();

            widgets.name        = "current temperatature";
            widgets.description = "Display the current temperature for a city";
            widgets.Params      = new List <Params>();
            Params p = new Params();

            p.name = "city";
            p.type = "string";
            widgets.Params.Add(p);
            services.widgets.Add(widgets);
            Widgets widgets2 = new Widgets();

            widgets2.name        = "Forecast over 7 days";
            widgets2.description = "Display the forecast for a city over 7 days";
            widgets2.Params      = new List <Params>();
            Params p2 = new Params();

            p2.name = "city";
            p2.type = "string";
            widgets2.Params.Add(p2);
            services.widgets.Add(widgets2);
            Services services2 = new Services();

            services2.name    = "Google Translate";
            services2.widgets = new List <Widgets>();
            Widgets widgets3 = new Widgets();

            widgets3.name        = "Trasnlation";
            widgets3.description = "Translate a text from a language from another";
            widgets3.Params      = new List <Params>();
            Params p3 = new Params();

            p3.name = "Source Language";
            p3.type = "string";
            Params p4 = new Params();

            p4.name = "Traget Language";
            p4.type = "string";
            Params p5 = new Params();

            p5.name = "Text";
            p5.type = "string";
            widgets3.Params.Add(p3);
            widgets3.Params.Add(p4);
            widgets3.Params.Add(p5);
            services2.widgets.Add(widgets3);
            json.server.services.Add(services);
            json.server.services.Add(services2);
            return(Json(json));
        }
Beispiel #3
0
        public JsonResult About()
        {
            var jsonAbout = new AboutJsonResponse();

            jsonAbout.client          = new Client();
            jsonAbout.server          = new Server();
            jsonAbout.server.services = new List <Service>();

            var weatherService  = new Service();
            var TwitchService   = new Service();
            var TwitterService  = new Service();
            var FacebookService = new Service();
            var GithubService   = new Service();
            var GmailService    = new Service();

            var weatherAction   = new Actions();
            var twitterAction   = new Actions();
            var facebookAction1 = new Actions();
            var facebookAction2 = new Actions();
            var facebookAction3 = new Actions();
            var gmailAction     = new Actions();

            weatherAction.name        = "daily_weather_mail";
            weatherAction.description = "send daily mail of today weather";

            twitterAction.name        = "daily_weather_tweet";
            twitterAction.description = "send daily tweet of today weather";

            facebookAction1.name        = "daily_weather_post";
            facebookAction1.description = "send daily post of today weather";
            facebookAction2.name        = "last_post_like";
            facebookAction2.description = "like the last facebook post";
            facebookAction3.name        = "comment_last_post";
            facebookAction3.description = "comment the last facebook post";
            gmailAction.name            = "daily_weather_mail";
            gmailAction.description     = "send daily mail of today weather";

            var weatherReaction  = new Reaction();
            var twitchReaction   = new Reaction();
            var twitterReaction  = new Reaction();
            var facebookReaction = new Reaction();
            var githubReaction1  = new Reaction();
            var githubReaction2  = new Reaction();
            var githubReaction3  = new Reaction();
            var githubReaction4  = new Reaction();
            var githubReaction5  = new Reaction();
            var githubReaction6  = new Reaction();
            var gmailReaction1   = new Reaction();
            var gmailReaction2   = new Reaction();
            var gmailReaction3   = new Reaction();
            var gmailReaction4   = new Reaction();

            weatherReaction.name         = "mail_rain";
            weatherReaction.description  = "send mail when it rains";
            twitchReaction.name          = "online_streamer_mail";
            twitchReaction.description   = "send mail when streamer is online";
            twitterReaction.name         = "online_streamer_tweet";
            twitterReaction.description  = "send tweet when streamer is online";
            facebookReaction.name        = "online_streamer_post";
            facebookReaction.description = "send post when streamer is online";
            githubReaction1.name         = "push_mail";
            githubReaction1.description  = "send mail when someone pushed into repository";
            githubReaction2.name         = "push_tweet";
            githubReaction2.description  = "send tweet when someone pushed into repository";
            githubReaction3.name         = "push_post";
            githubReaction3.description  = "send post when someone pushed into repository";
            githubReaction4.name         = "delete_mail";
            githubReaction4.description  = "send mail when someone deleted into repository";
            githubReaction5.name         = "delete_tweet";
            githubReaction5.description  = "send tweet when someone deleted into repository";
            githubReaction6.name         = "delete_post";
            githubReaction6.description  = "send post when someone deleted into repository";
            gmailReaction1.name          = "mail_rain";
            gmailReaction1.description   = "send mail when it rains";
            gmailReaction2.name          = "online_streamer_mail";
            gmailReaction2.description   = "send mail when streamer is online";
            gmailReaction3.name          = "push_mail";
            gmailReaction3.description   = "send mail when someone pushed into repository";
            gmailReaction4.name          = "delete_mail";
            gmailReaction4.description   = "send mail when someone deleted into repository";

            weatherService.name  = "openweathermap";
            TwitchService.name   = "twitch";
            TwitterService.name  = "twitter";
            FacebookService.name = "facebook";
            GithubService.name   = "github";
            GmailService.name    = "gmail";

            weatherService.actions  = new List <Actions>();
            TwitterService.actions  = new List <Actions>();
            FacebookService.actions = new List <Actions>();
            GmailService.actions    = new List <Actions>();

            weatherService.reactions  = new List <Reaction>();
            TwitchService.reactions   = new List <Reaction>();
            TwitterService.reactions  = new List <Reaction>();
            FacebookService.reactions = new List <Reaction>();
            GithubService.reactions   = new List <Reaction>();
            GmailService.reactions    = new List <Reaction>();

            weatherService.actions.Add(weatherAction);
            TwitterService.actions.Add(twitterAction);
            FacebookService.actions.Add(facebookAction1);
            FacebookService.actions.Add(facebookAction2);
            FacebookService.actions.Add(facebookAction3);
            GmailService.actions.Add(gmailAction);

            weatherService.reactions.Add(weatherReaction);
            TwitchService.reactions.Add(twitchReaction);
            TwitterService.reactions.Add(twitterReaction);
            FacebookService.reactions.Add(facebookReaction);
            GithubService.reactions.Add(githubReaction1);
            GithubService.reactions.Add(githubReaction2);
            GithubService.reactions.Add(githubReaction3);
            GithubService.reactions.Add(githubReaction4);
            GithubService.reactions.Add(githubReaction5);
            GithubService.reactions.Add(githubReaction6);
            GmailService.reactions.Add(gmailReaction1);
            GmailService.reactions.Add(gmailReaction2);
            GmailService.reactions.Add(gmailReaction3);
            GmailService.reactions.Add(gmailReaction4);

            jsonAbout.client.host         = GetLocalIPAddress();
            jsonAbout.server.current_time = Convert.ToInt32(DateTimeOffset.UtcNow.ToUnixTimeSeconds());

            jsonAbout.server.services.Add(weatherService);
            jsonAbout.server.services.Add(TwitchService);
            jsonAbout.server.services.Add(TwitterService);
            jsonAbout.server.services.Add(FacebookService);
            jsonAbout.server.services.Add(GithubService);
            jsonAbout.server.services.Add(GmailService);

            return(new JsonResult(jsonAbout));
        }