Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calendar.calendars.insert always results in a Missing Title error #1399

Closed
Merry3750 opened this issue Oct 22, 2018 · 3 comments
Closed

calendar.calendars.insert always results in a Missing Title error #1399

Merry3750 opened this issue Oct 22, 2018 · 3 comments
Assignees
Labels
type: question Request for information or clarification. Not an issue.

Comments

@Merry3750
Copy link

Whenever I run the calendar.calendars.insert function, I always get "Error: Missing Title". The docs say that the only required parameter is "summary", which is the title.

I took a look through the source code and I think part of the error is that within calendar.calendars.insert, the requiredParams array of the parameters object is empty, when it should contain summary. Relevant function below, and linked here .

  /**
     * calendar.calendars.insert
     * @desc Creates a secondary calendar.
     * @alias calendar.calendars.insert
     * @memberOf! ()
     *
     * @param {object} params Parameters for request
     * @param {().Calendar} params.resource Request body data
     * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
     * @param {callback} callback The callback that handles the response.
     * @return {object} Request object
     */
    insert(params?: Params$Resource$Calendars$Insert, options?: MethodOptions):
        AxiosPromise<Schema$Calendar>;
    insert(
        params: Params$Resource$Calendars$Insert,
        options: MethodOptions|BodyResponseCallback<Schema$Calendar>,
        callback: BodyResponseCallback<Schema$Calendar>): void;
    insert(
        params: Params$Resource$Calendars$Insert,
        callback: BodyResponseCallback<Schema$Calendar>): void;
    insert(callback: BodyResponseCallback<Schema$Calendar>): void;
    insert(
        paramsOrCallback?: Params$Resource$Calendars$Insert|
        BodyResponseCallback<Schema$Calendar>,
        optionsOrCallback?: MethodOptions|BodyResponseCallback<Schema$Calendar>,
        callback?: BodyResponseCallback<Schema$Calendar>):
        void|AxiosPromise<Schema$Calendar> {
      let params = (paramsOrCallback || {}) as Params$Resource$Calendars$Insert;
      let options = (optionsOrCallback || {}) as MethodOptions;

      if (typeof paramsOrCallback === 'function') {
        callback = paramsOrCallback;
        params = {} as Params$Resource$Calendars$Insert;
        options = {};
      }

      if (typeof optionsOrCallback === 'function') {
        callback = optionsOrCallback;
        options = {};
      }

      const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
      const parameters = {
        options: Object.assign(
            {
              url: (rootUrl + '/calendar/v3/calendars')
                       .replace(/([^:]\/)\/+/g, '$1'),
              method: 'POST'
            },
            options),
        params,
        requiredParams: [],
        pathParams: [],
        context: this.getRoot()
      };
      if (callback) {
        createAPIRequest<Schema$Calendar>(parameters, callback);
      } else {
        return createAPIRequest<Schema$Calendar>(parameters);
      }
    }
@JustinBeckwith JustinBeckwith added triage me I really want to be triaged. type: question Request for information or clarification. Not an issue. and removed triage me I really want to be triaged. labels Oct 22, 2018
@rug1
Copy link

rug1 commented Oct 24, 2018

I was getting this same error but if you nest it inside resource it works:

calendar.calendars.insert({
  resource: {
    summary: "Calendar Title"
  }
})

@AVaksman
Copy link
Contributor

@ACMerriman
The minimum required parameter for calendar.calendars.insert() function is the summary: Title of the calendar. Along with summary you can pass other values attributed to calendar (reference).

To properly pass parameters you have to specify the request body.

The example would be as follows

const res = await calendar.calendars.insert({
  requestBody: {
    summary: "Calendar Title", // required
    timezone: "Europe/Zurich", // optional
    description: "My Calendar" // optional
  }
})

Please confirm whether it worked for you.

@grant
Copy link
Contributor

grant commented Jan 30, 2019

@JustinBeckwith I think this could be closed too with #1399 (comment).

@JustinBeckwith JustinBeckwith self-assigned this Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

5 participants