wxc_sdk.common.schedules module
Schedules for locations or users
- class wxc_sdk.common.schedules.ScheduleApi(*, session: RestSession, base: ScheduleApiBase)[source]
Bases:
ApiChild
Schedules API
- list(obj_id: str, org_id: str | None = None, schedule_type: ScheduleType | None = None, name: str | None = None, **params) Generator[Schedule, None, None] [source]
List of Schedules for a Person or location
List schedules for a person or location in an organization.
Schedules are used to support calling features and can be defined at the location or person level. businessHours schedules allow you to apply specific call settings at different times of the day or week by defining one or more events. holidays schedules define exceptions to normal business hours by defining one or more events.
This API requires a full, user, or read-only administrator auth token with a scope of spark-admin:people_read.
- Parameters:
obj_id (str) – Return the list of schedules for this location or user
org_id (str) – List schedules for this organization.
schedule_type – Type of the schedule. businessHours - Business hours schedule type. holidays - Holidays schedule type.
name – Only return schedules with the matching name.
- Returns:
yields schedules
- details(obj_id: str, schedule_type: str | ScheduleType, schedule_id: str, org_id: str | None = None) Schedule [source]
Get Details for a Schedule
Retrieve Schedule details.
A time schedule establishes a set of times during the day or holidays in the year in which a feature, for example auto attendants, can perform a specific action.
Retrieving schedule details requires a full or read-only administrator auth token with a scope of spark-admin:telephony_config_read.
- Parameters:
obj_id (str) – Retrieve schedule details in this location or user
schedule_type (ScheduleTypeOrStr) – Type of the schedule. businessHours - Business hours schedule type. holidays - Holidays schedule type.
schedule_id (str) – Retrieve the schedule with the matching ID.
org_id (str) – Retrieve schedule details from this organization.
- Returns:
- create(obj_id: str, schedule: Schedule, org_id: str | None = None) str [source]
Create a Schedule
Create new Schedule for the given location.
A time schedule establishes a set of times during the day or holidays in the year in which a feature, for example auto attendants, can perform a specific action.
Creating a schedule requires a full administrator auth token with a scope of spark-admin:telephony_config_write.
- Parameters:
obj_id (str) – Create the schedule for this location or user
schedule (Schedule) – Schedule to be created
org_id (str) – Create the schedule for this organization.
- Returns:
ID of the newly created schedule.
- Return type:
str
- update(obj_id: str, schedule: Schedule, schedule_type: str | ScheduleType | None = None, schedule_id: str | None = None, org_id: str | None = None) str [source]
Update a Schedule
Update the designated Schedule.
A time schedule establishes a set of times during the day or holidays in the year in which a feature, for example auto attendants, can perform a specific action.
Updating a schedule requires a full administrator auth token with a scope of spark-admin:telephony_config_write.
NOTE: The Schedule ID will change upon modification of the Schedule name
- Parameters:
obj_id (str) – Location or user for which this schedule exists
schedule (Schedule) – data for the update
schedule_type (ScheduleTypeOrStr) – Type of the schedule. Default: schedule_type from schedule businessHours - Business hours schedule type. holidays - Holidays schedule type.
schedule_id (str) – Update schedule with the matching ID. Default: schedule_id from schedule
org_id (str) – Update schedule from this organization.
- Returns:
schedule id
- delete_schedule(obj_id: str, schedule_type: str | ScheduleType, schedule_id: str, org_id: str | None = None)[source]
Delete a Schedule
Delete the designated Schedule.
A time schedule establishes a set of times during the day or holidays in the year in which a feature, for example auto attendants, can perform a specific action.
Deleting a schedule requires a full administrator auth token with a scope of spark-admin:telephony_config_write.
- Parameters:
obj_id (str) – Location or user from which to delete a schedule.
schedule_type (ScheduleTypeOrStr) – Type of the schedule. businessHours - Business hours schedule type. holidays - Holidays schedule type.
schedule_id (str) – Delete the schedule with the matching ID.
org_id (str) – Retrieve schedule details from this organization.
- Returns:
- event_details(obj_id: str, schedule_type: str | ScheduleType, schedule_id: str, event_id: str, org_id: str | None = None) Event [source]
Get Details for a Schedule Event
Retrieve Schedule Event details.
A time schedule establishes a set of times during the day or holidays in the year in which a feature, for example auto attendants, can perform a specific action.
Retrieving schedule event details requires a full or read-only administrator auth token with a scope of spark-admin:telephony_config_read.
- Parameters:
obj_id (str) – Retrieve schedule event details for this location or user
schedule_type (ScheduleTypeOrStr) – Type of the schedule. businessHours - Business hours schedule type. holidays - Holidays schedule type.
schedule_id (str) – Retrieve schedule event details for schedule with the matching ID.
event_id (str) – Retrieve the schedule event with the matching schedule event ID.
org_id (str) – Retrieve schedule event details from this organization.
- Returns:
- event_create(obj_id: str, schedule_type: str | ScheduleType, schedule_id: str, event: Event, org_id: str | None = None) str [source]
Create a Schedule Event
Create new Event for the given location or user Schedule.
A time schedule establishes a set of times during the day or holidays in the year in which a feature, for example auto attendants, can perform a specific action.
Creating a schedule event requires a full administrator auth token with a scope of spark-admin:telephony_config_write.
- Parameters:
obj_id (str) – Create the schedule for this location.
schedule_type (ScheduleTypeOrStr) – Type of the schedule. businessHours - Business hours schedule type. holidays - Holidays schedule type.
schedule_id (str) – Create event for a given schedule ID.
event (Event) – event data
org_id (str) – Retrieve schedule event details from this organization.
- Returns:
event id
- Return type:
str
- event_update(obj_id: str, schedule_type: str | ScheduleType, schedule_id: str, event: Event, event_id: str | None = None, org_id: str | None = None) str [source]
Update a Schedule Event
Update the designated Schedule Event.
A time schedule establishes a set of times during the day or holidays in the year in which a feature, for example auto attendants, can perform a specific action.
Updating a schedule event requires a full administrator auth token with a scope of spark-admin:telephony_config_write.
NOTE: The Schedule Event ID will change upon modification of the Schedule event name.
- Parameters:
obj_id (str) – Location or user for which this schedule event exists.
schedule_type (ScheduleTypeOrStr) – Type of the schedule. businessHours - Business hours schedule type. holidays - Holidays schedule type.
schedule_id (str) – Update schedule event with the matching schedule ID.
event (Event) – update settings
event_id (str) – Update the schedule event with the matching schedule event ID. Default: event id from event
org_id (str) – Update schedule from this organization.
- Returns:
event id; changed if name changed
- base = 'telephony/config/locations'
- event_delete(obj_id: str, schedule_type: str | ScheduleType, schedule_id: str, event_id: str, org_id: str | None = None)[source]
Delete a Schedule Event
Delete the designated Schedule Event.
A time schedule establishes a set of times during the day or holidays in the year in which a feature, for example auto attendants, can perform a specific action.
Deleting a schedule event requires a full administrator auth token with a scope of spark-admin:telephony_config_write.
- Parameters:
obj_id (str) – Location or user from which to delete a schedule.
schedule_type (ScheduleTypeOrStr) – Type of the schedule. businessHours - Business hours schedule type. holidays - Holidays schedule type.
schedule_id (str) – Delete schedule event with the matching schedule ID.
event_id (str) – Delete the schedule event with the matching schedule event ID. Default: event id from event
org_id (str) – Delete schedule from this organization.
- class wxc_sdk.common.schedules.ScheduleType(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
str
,SafeEnum
An enumeration.
- business_hours = 'businessHours'
- holidays = 'holidays'
- static type_or_str(v: str | ScheduleType) ScheduleType [source]
- class wxc_sdk.common.schedules.ScheduleMonth(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
str
,SafeEnum
Month used in yearly recurrences
- jan = 'JANUARY'
- feb = 'FEBRUARY'
- mar = 'MARCH'
- apr = 'APRIL'
- may = 'MAY'
- jun = 'JUNE'
- jul = 'JULY'
- aug = 'AUGUST'
- sep = 'SEPTEMBER'
- oct = 'OCTOBER'
- nov = 'NOVEMBER'
- dec = 'DECEMBER'
- class wxc_sdk.common.schedules.ScheduleDay(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
str
,SafeEnum
An enumeration.
- monday = 'MONDAY'
- tuesday = 'TUESDAY'
- wednesday = 'WEDNESDAY'
- thursday = 'THURSDAY'
- friday = 'FRIDAY'
- saturday = 'SATURDAY'
- sunday = 'SUNDAY'
- class wxc_sdk.common.schedules.ScheduleWeek(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
str
,SafeEnum
Week used in monthly recurrence
- first = 'FIRST'
- second = 'SECOND'
- third = 'THIRD'
- fourth = 'FOURTH'
- class wxc_sdk.common.schedules.RecurWeekly(*, recurInterval: int | None = None, sunday: bool = False, monday: bool = False, tuesday: bool = False, wednesday: bool = False, thursday: bool = False, friday: bool = False, saturday: bool = False)[source]
Bases:
ApiModel
Specifies the event recur weekly on the designated days of the week
- recur_interval: int | None
Specifies the number of weeks between the start of each recurrence.
- sunday: bool
- monday: bool
- tuesday: bool
- wednesday: bool
- thursday: bool
- friday: bool
- saturday: bool
- enable_day(day: ScheduleDay | date)[source]
set recurrence to True on one day
- Parameters:
day – can either be a
ScheduleDay
or adatetime.date
- static single_day(day: ScheduleDay | date, recur_interval: int = 1) RecurWeekly [source]
Weekly recurrence for a single day
- Parameters:
day – can either be a
ScheduleDay
or adatetime.date
recur_interval – Specifies the number of weeks between the start of each recurrence.
- Returns:
weekly recurrence
- Return type:
class:RecurWeekly
- class wxc_sdk.common.schedules.RecurYearlyByDate(*, dayOfMonth: int, month: ScheduleMonth)[source]
Bases:
ApiModel
- day_of_month: int
- month: ScheduleMonth
- static from_date(date: date) RecurYearlyByDate [source]
- class wxc_sdk.common.schedules.RecurYearlyByDay(*, day: ScheduleDay, week: ScheduleWeek, month: ScheduleMonth)[source]
Bases:
ApiModel
- day: ScheduleDay
- week: ScheduleWeek
- month: ScheduleMonth
- class wxc_sdk.common.schedules.Recurrence(*, recurForEver: bool | None = None, recurEndDate: date | None = None, recurEndOfOccurrence: int | None = None, recurDaily: RecurDaily | None = None, recurWeekly: RecurWeekly | None = None, recurYearlyByDate: RecurYearlyByDate | None = None, recurYearlyByDay: RecurYearlyByDay | None = None)[source]
Bases:
ApiModel
Recurrence scheme for an event. Location schedules support: recur_weekly, recur_yearly_by_date, recur_yearly_by_day User schedules support: recur_daily, recur_weekly
- recur_for_ever: bool | None
True if the event repeats forever. Requires either recurDaily or recurWeekly to be specified. user and location schedules
- recur_end_date: date | None
End date for the recurring event in the format of YYYY-MM-DD. Requires either recur_daily or recur_weekly to be specified. User and location schedules
- recur_end_of_occurrence: int | None
End recurrence after the event has repeated the specified number of times. Requires either recur_daily or recur_weekly to be specified. User schedules only.
- recur_daily: RecurDaily | None
Specifies the number of days between the start of each recurrence and is not allowed with recurWeekly. Only allowed for user schedules
- recur_weekly: RecurWeekly | None
Specifies the event recur weekly on the designated days of the week and is not allowed with recur_daily. allowed for user and location schedules
- recur_yearly_by_date: RecurYearlyByDate | None
only allowed for location schedules
- recur_yearly_by_day: RecurYearlyByDay | None
only allowed for location schedules
- static every_week(day: ScheduleDay | date) Recurrence [source]
weekly recurrence for a single day, forever
- Parameters:
day – can either be a
ScheduleDay
or adatetime.date
- Returns:
weekly recurrence
- Return type:
- class wxc_sdk.common.schedules.Event(*, id: str | None = None, name: str, newName: str | None = None, startDate: date | None = None, endDate: date | None = None, startTime: time | None = None, endTime: time | None = None, allDayEnabled: bool | None = None, recurrence: Recurrence | None = None)[source]
Bases:
ApiModel
- event_id: str | None
unique id of the event
- name: str
Name for the event.
- new_name: str | None
new name for the event, only used in updates
- start_date: date | None
Start date of the event, or first occurrence if repeating. This field is required if all_day_enabled field is present.
- end_date: date | None
End date of the event, or first occurrence if repeating, in the format of YYYY-MM-DD. This field is required if all_day_enabled field is present.
- start_time: time | None
Start time of the event. This field is required if all_day_enabled field is false or omitted.
- end_time: time | None
End time of the event. This field is required if all_day_enabled field is false or omitted.
- all_day_enabled: bool | None
True if it is all-day event.
- recurrence: Recurrence | None
Recurrence scheme for an event.
- class Config[source]
Bases:
object
- json_encoders = {<class 'datetime.time'>: <function Event.Config.<lambda>>}
- static day_start_end(name: str, day: date, start_time: int | time, end_time: int | time) Event [source]
Event on a given day with specified start and end time and weekly recurrence
- Parameters:
name – name of the event
day – start date
start_time – start time, can be hour or
datetime.time
end_time – end time, can be hour or
datetime.time
- Returns:
event
- Return type:
- class wxc_sdk.common.schedules.Schedule(*, name: str | None = None, newName: str | None = None, id: str | None = None, level: str | None = None, locationName: str | None = None, locationId: str | None = None, type: ScheduleType, events: list[Event] | None = None)[source]
Bases:
ApiModel
- name: str | None
Name for the schedule.
- new_name: str | None
new name for the schedule. Only used in update()
- schedule_id: str | None
Identifier for a schedule.
- level: str | None
listing user schedules returns user and location level schedules. This indicates the level. Can be USER or GROUP this attribute only exists when listing schedules at the user level
- location_name: str | None
location name, only returned by list() for location schedules
- location_id: str | None
location id, only returned by list() for location schedules
- schedule_type: ScheduleType
Indicates the schedule type whether businessHours or holidays
- class Config[source]
Bases:
object
- json_encoders = {<class 'datetime.time'>: <function Schedule.Config.<lambda>>}
- static business(name: str, day_start: int | time = 9, day_end: int | time = 17, break_start: int | time = 12, break_end: int | time = 13) Schedule [source]
Business schedule with the given times Mon-Fri
- Parameters:
name – schedule name
day_start (int) – daily start time, default: 9
day_end (int) – daily end time, default: 17
break_start (int) – start of break, default: 12
break_end (int) – end of break, default: 13
- Returns:
business hours schedule
- Return type: