Visual FoxPro Google Calendar: Get Color Definitions

Back to Index

Returns the color definitions for calendars and events.

Documentation: https://developers.google.com/google-apps/calendar/v3/reference/colors/get


LOCAL loRest
LOCAL lnSuccess
LOCAL loOauth2
LOCAL loSbJson
LOCAL loJson
LOCAL lcKind
LOCAL lcUpdated
LOCAL lcCalendar1Background
LOCAL lcCalendar1Foreground
LOCAL lcCalendar2Background
LOCAL lcCalendar2Foreground
LOCAL lcCalendar3Background
LOCAL lcCalendar3Foreground
LOCAL lcCalendar4Background
LOCAL lcCalendar4Foreground
LOCAL lcCalendar5Background
LOCAL lcCalendar5Foreground
LOCAL lcCalendar6Background
LOCAL lcCalendar6Foreground
LOCAL lcCalendar7Background
LOCAL lcCalendar7Foreground
LOCAL lcCalendar8Background
LOCAL lcCalendar8Foreground
LOCAL lcCalendar9Background
LOCAL lcCalendar9Foreground
LOCAL lcCalendar10Background
LOCAL lcCalendar10Foreground
LOCAL lcCalendar11Background
LOCAL lcCalendar11Foreground
LOCAL lcCalendar12Background
LOCAL lcCalendar12Foreground
LOCAL lcCalendar13Background
LOCAL lcCalendar13Foreground
LOCAL lcCalendar14Background
LOCAL lcCalendar14Foreground
LOCAL lcCalendar15Background
LOCAL lcCalendar15Foreground
LOCAL lcCalendar16Background
LOCAL lcCalendar16Foreground
LOCAL lcCalendar17Background
LOCAL lcCalendar17Foreground
LOCAL lcCalendar18Background
LOCAL lcCalendar18Foreground
LOCAL lcCalendar19Background
LOCAL lcCalendar19Foreground
LOCAL lcCalendar20Background
LOCAL lcCalendar20Foreground
LOCAL lcCalendar21Background
LOCAL lcCalendar21Foreground
LOCAL lcCalendar22Background
LOCAL lcCalendar22Foreground
LOCAL lcCalendar23Background
LOCAL lcCalendar23Foreground
LOCAL lcCalendar24Background
LOCAL lcCalendar24Foreground
LOCAL lcEvent1Background
LOCAL lcEvent1Foreground
LOCAL lcEvent2Background
LOCAL lcEvent2Foreground
LOCAL lcEvent3Background
LOCAL lcEvent3Foreground
LOCAL lcEvent4Background
LOCAL lcEvent4Foreground
LOCAL lcEvent5Background
LOCAL lcEvent5Foreground
LOCAL lcEvent6Background
LOCAL lcEvent6Foreground
LOCAL lcEvent7Background
LOCAL lcEvent7Foreground
LOCAL lcEvent8Background
LOCAL lcEvent8Foreground
LOCAL lcEvent9Background
LOCAL lcEvent9Foreground
LOCAL lcEvent10Background
LOCAL lcEvent10Foreground
LOCAL lcEvent11Background
LOCAL lcEvent11Foreground

loRest = CreateObject('Chilkat_9_5_0.Rest')

*   Provide a previously obtained OAuth2 access token.
loOauth2 = CreateObject('Chilkat_9_5_0.OAuth2')
loOauth2.AccessToken = "OAUTH2_ACCESS_TOKEN"
loRest.SetAuthOAuth2(loOauth2)

lnSuccess = loRest.Connect("www.googleapis.com",443,1,1)
IF (lnSuccess <> 1) THEN
    ? loRest.LastErrorText
    RELEASE loRest
    RELEASE loOauth2
    CANCEL
ENDIF

loSbJson = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestNoBodySb("GET","/calendar/v3/colors",loSbJson)
IF (lnSuccess <> 1) THEN
    ? loRest.LastErrorText
    RELEASE loRest
    RELEASE loOauth2
    RELEASE loSbJson
    CANCEL
ENDIF

IF (loRest.ResponseStatusCode <> 200) THEN
    ? "Received error response code: " + STR(loRest.ResponseStatusCode)
    ? "Response body:"
    ? loSbJson.GetAsString()
    RELEASE loRest
    RELEASE loOauth2
    RELEASE loSbJson
    CANCEL
ENDIF

loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.LoadSb(loSbJson)

*  The following code parses the JSON response.
*  A sample JSON response is shown below the sample code.

lcKind = loJson.StringOf("kind")
lcUpdated = loJson.StringOf("updated")
lcCalendar1Background = loJson.StringOf("calendar.1.background")
lcCalendar1Foreground = loJson.StringOf("calendar.1.foreground")
lcCalendar2Background = loJson.StringOf("calendar.2.background")
lcCalendar2Foreground = loJson.StringOf("calendar.2.foreground")
lcCalendar3Background = loJson.StringOf("calendar.3.background")
lcCalendar3Foreground = loJson.StringOf("calendar.3.foreground")
lcCalendar4Background = loJson.StringOf("calendar.4.background")
lcCalendar4Foreground = loJson.StringOf("calendar.4.foreground")
lcCalendar5Background = loJson.StringOf("calendar.5.background")
lcCalendar5Foreground = loJson.StringOf("calendar.5.foreground")
lcCalendar6Background = loJson.StringOf("calendar.6.background")
lcCalendar6Foreground = loJson.StringOf("calendar.6.foreground")
lcCalendar7Background = loJson.StringOf("calendar.7.background")
lcCalendar7Foreground = loJson.StringOf("calendar.7.foreground")
lcCalendar8Background = loJson.StringOf("calendar.8.background")
lcCalendar8Foreground = loJson.StringOf("calendar.8.foreground")
lcCalendar9Background = loJson.StringOf("calendar.9.background")
lcCalendar9Foreground = loJson.StringOf("calendar.9.foreground")
lcCalendar10Background = loJson.StringOf("calendar.10.background")
lcCalendar10Foreground = loJson.StringOf("calendar.10.foreground")
lcCalendar11Background = loJson.StringOf("calendar.11.background")
lcCalendar11Foreground = loJson.StringOf("calendar.11.foreground")
lcCalendar12Background = loJson.StringOf("calendar.12.background")
lcCalendar12Foreground = loJson.StringOf("calendar.12.foreground")
lcCalendar13Background = loJson.StringOf("calendar.13.background")
lcCalendar13Foreground = loJson.StringOf("calendar.13.foreground")
lcCalendar14Background = loJson.StringOf("calendar.14.background")
lcCalendar14Foreground = loJson.StringOf("calendar.14.foreground")
lcCalendar15Background = loJson.StringOf("calendar.15.background")
lcCalendar15Foreground = loJson.StringOf("calendar.15.foreground")
lcCalendar16Background = loJson.StringOf("calendar.16.background")
lcCalendar16Foreground = loJson.StringOf("calendar.16.foreground")
lcCalendar17Background = loJson.StringOf("calendar.17.background")
lcCalendar17Foreground = loJson.StringOf("calendar.17.foreground")
lcCalendar18Background = loJson.StringOf("calendar.18.background")
lcCalendar18Foreground = loJson.StringOf("calendar.18.foreground")
lcCalendar19Background = loJson.StringOf("calendar.19.background")
lcCalendar19Foreground = loJson.StringOf("calendar.19.foreground")
lcCalendar20Background = loJson.StringOf("calendar.20.background")
lcCalendar20Foreground = loJson.StringOf("calendar.20.foreground")
lcCalendar21Background = loJson.StringOf("calendar.21.background")
lcCalendar21Foreground = loJson.StringOf("calendar.21.foreground")
lcCalendar22Background = loJson.StringOf("calendar.22.background")
lcCalendar22Foreground = loJson.StringOf("calendar.22.foreground")
lcCalendar23Background = loJson.StringOf("calendar.23.background")
lcCalendar23Foreground = loJson.StringOf("calendar.23.foreground")
lcCalendar24Background = loJson.StringOf("calendar.24.background")
lcCalendar24Foreground = loJson.StringOf("calendar.24.foreground")
lcEvent1Background = loJson.StringOf("event.1.background")
lcEvent1Foreground = loJson.StringOf("event.1.foreground")
lcEvent2Background = loJson.StringOf("event.2.background")
lcEvent2Foreground = loJson.StringOf("event.2.foreground")
lcEvent3Background = loJson.StringOf("event.3.background")
lcEvent3Foreground = loJson.StringOf("event.3.foreground")
lcEvent4Background = loJson.StringOf("event.4.background")
lcEvent4Foreground = loJson.StringOf("event.4.foreground")
lcEvent5Background = loJson.StringOf("event.5.background")
lcEvent5Foreground = loJson.StringOf("event.5.foreground")
lcEvent6Background = loJson.StringOf("event.6.background")
lcEvent6Foreground = loJson.StringOf("event.6.foreground")
lcEvent7Background = loJson.StringOf("event.7.background")
lcEvent7Foreground = loJson.StringOf("event.7.foreground")
lcEvent8Background = loJson.StringOf("event.8.background")
lcEvent8Foreground = loJson.StringOf("event.8.foreground")
lcEvent9Background = loJson.StringOf("event.9.background")
lcEvent9Foreground = loJson.StringOf("event.9.foreground")
lcEvent10Background = loJson.StringOf("event.10.background")
lcEvent10Foreground = loJson.StringOf("event.10.foreground")
lcEvent11Background = loJson.StringOf("event.11.background")
lcEvent11Foreground = loJson.StringOf("event.11.foreground")

? "Example Completed."

RELEASE loRest
RELEASE loOauth2
RELEASE loSbJson
RELEASE loJson

Sample JSON Response Body

{
  "kind": "calendar#colors",
  "updated": "2012-02-14T00:00:00.000Z",
  "calendar": {
    "1": {
      "background": "#ac725e",
      "foreground": "#1d1d1d"
    },
    "2": {
      "background": "#d06b64",
      "foreground": "#1d1d1d"
    },
    "3": {
      "background": "#f83a22",
      "foreground": "#1d1d1d"
    },
    "4": {
      "background": "#fa573c",
      "foreground": "#1d1d1d"
    },
    "5": {
      "background": "#ff7537",
      "foreground": "#1d1d1d"
    },
    "6": {
      "background": "#ffad46",
      "foreground": "#1d1d1d"
    },
    "7": {
      "background": "#42d692",
      "foreground": "#1d1d1d"
    },
    "8": {
      "background": "#16a765",
      "foreground": "#1d1d1d"
    },
    "9": {
      "background": "#7bd148",
      "foreground": "#1d1d1d"
    },
    "10": {
      "background": "#b3dc6c",
      "foreground": "#1d1d1d"
    },
    "11": {
      "background": "#fbe983",
      "foreground": "#1d1d1d"
    },
    "12": {
      "background": "#fad165",
      "foreground": "#1d1d1d"
    },
    "13": {
      "background": "#92e1c0",
      "foreground": "#1d1d1d"
    },
    "14": {
      "background": "#9fe1e7",
      "foreground": "#1d1d1d"
    },
    "15": {
      "background": "#9fc6e7",
      "foreground": "#1d1d1d"
    },
    "16": {
      "background": "#4986e7",
      "foreground": "#1d1d1d"
    },
    "17": {
      "background": "#9a9cff",
      "foreground": "#1d1d1d"
    },
    "18": {
      "background": "#b99aff",
      "foreground": "#1d1d1d"
    },
    "19": {
      "background": "#c2c2c2",
      "foreground": "#1d1d1d"
    },
    "20": {
      "background": "#cabdbf",
      "foreground": "#1d1d1d"
    },
    "21": {
      "background": "#cca6ac",
      "foreground": "#1d1d1d"
    },
    "22": {
      "background": "#f691b2",
      "foreground": "#1d1d1d"
    },
    "23": {
      "background": "#cd74e6",
      "foreground": "#1d1d1d"
    },
    "24": {
      "background": "#a47ae2",
      "foreground": "#1d1d1d"
    }
  },
  "event": {
    "1": {
      "background": "#a4bdfc",
      "foreground": "#1d1d1d"
    },
    "2": {
      "background": "#7ae7bf",
      "foreground": "#1d1d1d"
    },
    "3": {
      "background": "#dbadff",
      "foreground": "#1d1d1d"
    },
    "4": {
      "background": "#ff887c",
      "foreground": "#1d1d1d"
    },
    "5": {
      "background": "#fbd75b",
      "foreground": "#1d1d1d"
    },
    "6": {
      "background": "#ffb878",
      "foreground": "#1d1d1d"
    },
    "7": {
      "background": "#46d6db",
      "foreground": "#1d1d1d"
    },
    "8": {
      "background": "#e1e1e1",
      "foreground": "#1d1d1d"
    },
    "9": {
      "background": "#5484ed",
      "foreground": "#1d1d1d"
    },
    "10": {
      "background": "#51b749",
      "foreground": "#1d1d1d"
    },
    "11": {
      "background": "#dc2127",
      "foreground": "#1d1d1d"
    }
  }
}