Exemplo n.º 1
0
        public static async Task Run([TimerTrigger("0 0 1 * * *")] TimerInfo myTimer, ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a Watch Gmail request.");
            string token = await AuthenticateGoogle.RefreshAccessToken(log);

            GmailAPI api          = new GmailAPI(log, token);
            dynamic  response     = api.Watch();
            string   responseBody = JsonConvert.SerializeObject(response);

            log.LogInformation($"{responseBody}");
        }
Exemplo n.º 2
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a Watch Gmail request.");
            string token = await AuthenticateGoogle.RefreshAccessToken(log);

            GmailAPI api          = new GmailAPI(log, token);
            dynamic  response     = api.Watch();
            string   responseBody = JsonConvert.SerializeObject(response);

            return(new OkObjectResult($"{responseBody}"));
        }