wix-events-backend createEvent() 代码在 eventInfo 上失败

wix-events-backend createEvent() code failing on eventInfo

正在尝试为 Wix 事件创建程序化事件。

已按照此处详述的步骤操作: https://www.wix.com/velo/reference/wix-events-backend/wixevents/createevent

import { wixEvents } from "wix-events-backend";

const eventInfo = {
  title: "Healthy Living Series: Exercise and You",
  location: {
    name: "Community Hall",
    address: {
      formatted: "100 Gansevoort St, New York, NY 10014, USA",
      city: "New York City",
      subdivision: "New York",
      country: "USA",
      postalCode: "10014",
      streetAddress: {
        number: "100",
        name: "Gansevoort Street",
        apt: "10"
      }
    },
    type: 'VENUE',
  },
  scheduling: {
    startDate: "2021-09-14T13:30:00.000Z",
    endDate: "2021-09-14T15:30:00.000Z",
    timeZoneId: "America/New_York"
  },
  registration: {
    initialType: 'RSVP'
  }
};

const options = {
  language: "en"
};

export function myCreateEventFunction() {
  return wixEvents.createEvent(eventInfo, options)
    .then((result) => {
      return result;
    })
    .catch((error) => {
      console.error(error);
    });
}

提供的代码片段因 eventInfo 参数出现此错误而失败:

Argument of type '{ title: any; description: any; about: any; location: { name: any; address: { formatted: any; city: any; subdivision: any; country: any; postalCode: any; streetAddress: { number: string; name: string; apt: string; }; }; type: string; }; scheduling: { ...; }; registration: { ...; }; }' is not assignable to parameter of type 'WixEventInfo'. Type '{ title: any; description: any; about: any; location: { name: any; address: { formatted: any; city: any; subdivision: any; country: any; postalCode: any; streetAddress: { number: string; name: string; apt: string; }; }; type: string; }; scheduling: { ...; }; registration: { ...; }; }' is missing the following properties from type 'WixEventInfo': locationInfo, schedulingInfo

有人知道如何解决这个问题吗?

我在编辑器中看到了同样的错误,但如果您实际上 运行 代码,您可能会得到不同的错误,通过 .catch((error) 传递给 console.log。

我能够通过测试代码创建一个事件 a) 从

更改不正确的位置国家字段
    country: "USA",

    country: "US",

b) 删除计划字段开始和结束日期并改用 TBD:

  scheduling: {
    tbd: true,
    tbdMessage: "pending my dates",
    timeZoneId: "EST"
  }

我尝试了很多不同的开始日期和结束日期格式,但都无法正常工作,包括示例中的格式

    startDate: "2021-09-14T13:30:00.000Z",
    endDate: "2021-09-14T15:30:00.000Z",

Wix 文档也没有多大帮助,例如在定义输入参数 eventInfo 时 - 它说该结构包含一个名称为“schedulingInfo”的对象,但这不正确,它必须是“scheduling”;奇怪的是,如果您在代码中将其更改为 schedulingInfo(以及将位置更改为 locationInfo),您不会收到发布的静态错误,但会收到 运行-time 错误。

我将在 Wix 的论坛中提出这个问题,请注意。