Methods for dealing with Cities.

Hierarchy

  • SdkModule
    • Cities

Methods

  • Add a new city.

    Parameters

    • options: { cityName: string; countryId?: number; stateId?: number }
      • cityName: string

        A name of the new city.

      • OptionalcountryId?: number

        An id of the country of the city. If none provided, the top country from the data model would be used.

      • OptionalstateId?: number

        An id of the state of the city, if any.

    Returns City

    a new city object

    DataModelNotFoundError in case the country or state are not found in the WME data model

    InvalidStateError in case not allowed to add a new city, if there's no top country or if city already exists.

  • Returns City[]

    an array of all the cities in the WME data model

  • Parameters

    • args: { cityId: number }
      • cityId: number

        The id of the city to look for.

    Returns null | City

    city with id, or null if not found in the WME data model

  • Find a city by the name.

    Parameters

    • options: { cityName: string; countryId?: number; stateId?: number }
      • cityName: string

        A name of the city.

      • OptionalcountryId?: number

        An optional id of the country to look for the city. If none provided, the top country from the data model would be used.

      • OptionalstateId?: number

        An optional id of the state to look for the city.

    Returns null | City

    a city object or null if not found

    DataModelNotFoundError in case the country or state are not found in the WME data model

    InvalidStateError in case country id wasn't provided and there's no top country

  • Get the City set to be the top city in the WME data model, or null if none set. The top city is the city which the majority of segments in the WME data model belong to.

    Returns null | City

    top city or null