public RestfulServiceRequest CreateCalendarList(object body, [Optional] string[] fields, [Optional] string requestorID)
        {
            var _queryValues = new List <KeyValuePair <string, string> >(2);

            if (_optional_commaDelimitedString_isSupplied(fields))
            {
                _queryValues.Add(new KeyValuePair <string, string>("fields", _optional_commaDelimitedString_encodeString(fields)));
            }
            if (_optional_string_isSupplied(requestorID))
            {
                _queryValues.Add(new KeyValuePair <string, string>("xoauth_requestor_id", _optional_string_encodeString(requestorID)));
            }

            if (body == null)
            {
                throw new ArgumentNullException("body");
            }

            var requestUri = constructRequestUri("/calendar/v3/users/me/calendarList", _queryValues);
            var req        = (HttpWebRequest)HttpWebRequest.Create(requestUri);

            req.Method      = "POST";
            req.ContentType = "application/json";

            return(new RestfulServiceRequest(authentication, req, (st) => RestfulServiceRequest.SerializeJSON(st, body), RestfulServiceRequest.DeserializeJSON));
        }
        public RestfulServiceRequest UpdateEvent(string calendarId, string eventId, object body, [Optional] string[] fields, [Optional] string requestorID)
        {
            string r_calendarId;

            if (!_required_string_isSupplied(calendarId))
            {
                throw new ArgumentNullException("calendarId");
            }
            else
            {
                r_calendarId = _required_string_encodeString(calendarId);
            }
            string r_eventId;

            if (!_required_string_isSupplied(eventId))
            {
                throw new ArgumentNullException("eventId");
            }
            else
            {
                r_eventId = _required_string_encodeString(eventId);
            }

            var _queryValues = new List <KeyValuePair <string, string> >(2);

            if (_optional_commaDelimitedString_isSupplied(fields))
            {
                _queryValues.Add(new KeyValuePair <string, string>("fields", _optional_commaDelimitedString_encodeString(fields)));
            }
            if (_optional_string_isSupplied(requestorID))
            {
                _queryValues.Add(new KeyValuePair <string, string>("xoauth_requestor_id", _optional_string_encodeString(requestorID)));
            }

            if (body == null)
            {
                throw new ArgumentNullException("body");
            }

            var requestUri = constructRequestUri("/calendar/v3/calendars/" + EncodeRFC3986(r_calendarId) + "/events/" + EncodeRFC3986(r_eventId), _queryValues);
            var req        = (HttpWebRequest)HttpWebRequest.Create(requestUri);

            req.Method      = "PUT";
            req.ContentType = "application/json";

            return(new RestfulServiceRequest(authentication, req, (st) => RestfulServiceRequest.SerializeJSON(st, body), RestfulServiceRequest.DeserializeJSON));
        }