-
-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
booking namespace new types & methods
- Loading branch information
Showing
63 changed files
with
1,177 additions
and
442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
Configure and use push notifications in SharePoint apps | ||
""" | ||
|
||
from office365.sharepoint.client_context import ClientContext | ||
from office365.sharepoint.features.definitions.scope import FeatureDefinitionScope | ||
from office365.sharepoint.features.known_list import KnownFeaturesList | ||
from tests import test_client_credentials, test_site_url | ||
|
||
|
||
def subscribe_to_service(): | ||
"""""" | ||
|
||
|
||
ctx = ClientContext(test_site_url).with_credentials(test_client_credentials) | ||
f = ctx.web.features.add(KnownFeaturesList.PushNotifications, False, FeatureDefinitionScope.Farm, True).execute_query() | ||
print("Feature has been activated.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from office365.entity import Entity | ||
|
||
|
||
class BookingAppointment(Entity): | ||
""" | ||
Represents a business in Microsoft Bookings. This is the top level object in the Microsoft Bookings API. | ||
It contains business information and related business objects such as appointments, customers, services, | ||
and staff members. | ||
""" |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
from office365.booking.appointment import BookingAppointment | ||
from office365.booking.custom_question import BookingCustomQuestion | ||
from office365.booking.customers.base import BookingCustomerBase | ||
from office365.booking.service import BookingService | ||
from office365.booking.staff.availability_item import StaffAvailabilityItem | ||
from office365.booking.staff.member_base import BookingStaffMemberBase | ||
from office365.booking.work_hours import BookingWorkHours | ||
from office365.entity import Entity | ||
from office365.entity_collection import EntityCollection | ||
from office365.outlook.mail.physical_address import PhysicalAddress | ||
from office365.runtime.client_result import ClientResult | ||
from office365.runtime.client_value_collection import ClientValueCollection | ||
from office365.runtime.paths.resource_path import ResourcePath | ||
from office365.runtime.queries.service_operation import ServiceOperationQuery | ||
|
||
|
||
class BookingBusiness(Entity): | ||
"""Represents a business in Microsoft Bookings. This is the top level object in the Microsoft Bookings API. | ||
It contains business information and related business objects such as appointments, customers, services, | ||
and staff members.""" | ||
|
||
def get_staff_availability(self, staff_ids=None, start_datetime=None, end_datetime=None): | ||
""" | ||
Get the availability information of staff members of a Microsoft Bookings calendar. | ||
:param list[str] staff_ids: The list of staff IDs | ||
:param datetime.datetime start_datetime: | ||
:param datetime.datetime end_datetime: | ||
""" | ||
return_type = ClientResult(self.context, ClientValueCollection(StaffAvailabilityItem)) | ||
payload = { | ||
"staffIds": staff_ids, | ||
"startDateTime": start_datetime, | ||
"endDateTime": end_datetime | ||
} | ||
qry = ServiceOperationQuery(self, "getStaffAvailability", None, payload, None, return_type) | ||
self.context.add_query(qry) | ||
return return_type | ||
|
||
@property | ||
def address(self): | ||
""" | ||
The street address of the business. The address property, together with phone and webSiteUrl, appear in the | ||
footer of a business scheduling page. The attribute type of physicalAddress is not supported in v1.0. | ||
Internally we map the addresses to the type others. | ||
""" | ||
return self.properties.get("address", PhysicalAddress()) | ||
|
||
@property | ||
def business_hours(self): | ||
""" | ||
The hours of operation for the business. | ||
""" | ||
return self.properties.get("businessHours", ClientValueCollection(BookingWorkHours)) | ||
|
||
def display_name(self): | ||
""" | ||
The name of the business, which interfaces with customers. This name appears at the top of the business | ||
scheduling page. | ||
:rtype: str or None | ||
""" | ||
return self.properties.get('displayName', None) | ||
|
||
@property | ||
def appointments(self): | ||
"""All the appointments of this business. Read-only. Nullable.""" | ||
return self.properties.get('appointments', | ||
EntityCollection(self.context, BookingAppointment, | ||
ResourcePath("appointments", self.resource_path))) | ||
|
||
@property | ||
def calendar_view(self): | ||
"""The set of appointments of this business in a specified date range. Read-only. Nullable.""" | ||
return self.properties.get('calendarView', | ||
EntityCollection(self.context, BookingAppointment, | ||
ResourcePath("calendarView", self.resource_path))) | ||
|
||
@property | ||
def customers(self): | ||
"""All the customers of this business. Read-only. Nullable.""" | ||
return self.properties.get('customers', | ||
EntityCollection(self.context, BookingCustomerBase, | ||
ResourcePath("customers", self.resource_path))) | ||
|
||
@property | ||
def custom_questions(self): | ||
"""All the services offered by this business. Read-only. Nullable.""" | ||
return self.properties.get('customQuestions', | ||
EntityCollection(self.context, BookingCustomQuestion, | ||
ResourcePath("customQuestions", self.resource_path))) | ||
|
||
@property | ||
def services(self): | ||
"""All the services offered by this business. Read-only. Nullable.""" | ||
return self.properties.get('services', | ||
EntityCollection(self.context, BookingService, | ||
ResourcePath("services", self.resource_path))) | ||
|
||
@property | ||
def staff_members(self): | ||
"""The collection of open extensions defined for the message. Nullable.""" | ||
return self.properties.get('staffMembers', | ||
EntityCollection(self.context, BookingStaffMemberBase, | ||
ResourcePath("staffMembers", self.resource_path))) | ||
|
||
def get_property(self, name, default_value=None): | ||
if default_value is None: | ||
property_mapping = { | ||
"businessHours": self.business_hours, | ||
"calendarView": self.calendar_view, | ||
"customQuestions": self.custom_questions, | ||
"staffMembers": self.staff_members | ||
} | ||
default_value = property_mapping.get(name, None) | ||
return super(BookingBusiness, self).get_property(name, default_value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from office365.booking.business.business import BookingBusiness | ||
from office365.entity_collection import EntityCollection | ||
|
||
|
||
class BookingBusinessCollection(EntityCollection): | ||
"""""" | ||
|
||
def __init__(self, context, resource_path=None): | ||
super(BookingBusinessCollection, self).__init__(context, BookingBusiness, resource_path) | ||
|
||
def add(self, display_name): | ||
""" | ||
Create a new Microsoft Bookings business in a tenant. | ||
:param str display_name: The business display name. | ||
""" | ||
props = { | ||
"displayName": display_name, | ||
} | ||
return super(BookingBusinessCollection, self).add(**props) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.entity import Entity | ||
|
||
|
||
class BookingCustomQuestion(Entity): | ||
"""Represents a custom question for a bookingBusiness.""" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.entity import Entity | ||
|
||
|
||
class BookingCustomerBase(Entity): | ||
"""""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from office365.entity import Entity | ||
|
||
|
||
class BookingService(Entity): | ||
""" | ||
Represents information about a particular service provided by a bookingBusiness, such as the service name, | ||
price, and the staff that usually provides such service. | ||
""" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class StaffAvailabilityItem(ClientValue): | ||
"""Represents the available and busy time slots of a Microsoft Bookings staff member.""" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from office365.directory.policies.conditional_access import ConditionalAccessPolicy | ||
from office365.runtime.client_value import ClientValue | ||
from office365.runtime.client_value_collection import ClientValueCollection | ||
|
||
|
||
class AuthenticationStrengthUsage(ClientValue): | ||
""" | ||
An object containing two collections of Conditional Access policies that reference the specified authentication | ||
strength. One collection references Conditional Access policies that require an MFA claim; the other collection | ||
references Conditional Access policies that don't require such a claim. | ||
""" | ||
|
||
def __init__(self, mfa=None, none=None): | ||
""" | ||
:param list[ConditionalAccessPolicy] mfa: A collection of Conditional Access policies that reference the | ||
specified authentication strength policy and that require an MFA claim. | ||
:param list[ConditionalAccessPolicy] none: A collection of Conditional Access policies that reference the | ||
specified authentication strength policy and that do not require an MFA claim. | ||
""" | ||
self.mfa = ClientValueCollection(ConditionalAccessPolicy, mfa) | ||
self.none = ClientValueCollection(ConditionalAccessPolicy, none) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from office365.entity import Entity | ||
|
||
|
||
class Artifact(Entity): | ||
"""Represents an abstract entity found online by Microsoft security services.""" | ||
|
||
@property | ||
def entity_type_name(self): | ||
return "microsoft.graph.security.artifact" |
Oops, something went wrong.