axios多帖,订阅events.watch

时间:2019-02-18 11:07:58

标签: google-calendar-api axios

我正在尝试按照以下说明观看来自多个日历的事件:

https://developers.google.com/calendar/v3/reference/events/watch

我需要观看大约50个日历,我正在使用axios.all-如何存储每个帖子的回复?

axios.all([
  axios.post('https://www.googleapis.com/calendar/v3/calendars/xxx/events/watch',
 {
      type: "web_hook",
      address: "https:/rguc-calendars.firebaseapp.com/notifications"
    },
    {
      "Content-Type": "application/json;charset=UTF-8",
      Authorization: tokens.token_type + " " + tokens.access_token
    }

    ),
  axios.post('https://www.googleapis.com/calendar/v3/calendars/xxx/events/watch',
     {
      type: "web_hook",
      address: "https:/rguc-calendars.firebaseapp.com/notifications"
    },
    {
      "Content-Type": "application/json;charset=UTF-8",
      Authorization: tokens.token_type + " " + tokens.access_token
    }

    ),
  axios.post('https://www.googleapis.com/calendar/v3/calendars/xxx/events/watch',
     {
      type: "web_hook",
      address: "https:/rguc-calendars.firebaseapp.com/notifications"
    },
    {
      "Content-Type": "application/json;charset=UTF-8",
      Authorization: tokens.token_type + " " + tokens.access_token
    })
  axios.post('https://www.googleapis.com/calendar/v3/calendars/xxxm/events/watch',
     {
      type: "web_hook",
      address: "https:/rguc-calendars.firebaseapp.com/notifications"
    },
    {
      "Content-Type": "application/json;charset=UTF-8",
      Authorization: tokens.token_type + " " + tokens.access_token
    })
....etc
     ])
      .then(axios.spread(function (acct, perms) {
     console.log("subscribed to all event watches")
      }));

0 个答案:

没有答案