Skip to content

Commit

Permalink
introduced CoC, sitepages namespace types updates
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrem committed Dec 15, 2024
1 parent 585bb3a commit 92fb43a
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Treat each other well

Everyone participating in the _Office365-REST-Python-Client_ project, and in particular in the issue tracker,
pull requests, and social media activity, is expected to treat other people with respect
and more generally to follow the guidelines articulated in the
[Python Community Code of Conduct](https://www.python.org/psf/codeofconduct/).
12 changes: 12 additions & 0 deletions office365/onedrive/driveitems/driveItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class DriveItem(BaseItem):
OneDrive and SharePoint are returned as driveItem resources"""

def get_files(self, recursive=False, page_size=None):
# type: (bool, Optional[int]) -> EntityCollection["DriveItem"]
"""Retrieves files
:param bool recursive: Determines whether to enumerate folders recursively
:param int page_size: Page size
Expand Down Expand Up @@ -94,6 +95,7 @@ def _after_loaded(col):
return return_type

def get_folders(self, recursive=False, page_size=None):
# type: (bool, Optional[int]) -> EntityCollection["DriveItem"]
"""Retrieves folders
:param bool recursive: Determines whether to enumerate folders recursively
:param int page_size: Page size
Expand Down Expand Up @@ -177,6 +179,16 @@ def create_link(
self.context.add_query(qry)
return return_type

def discard_checkout(self):
"""Discard the check out of a driveItem. This action releases a driveItem resource that was previously
checked out. Any changes made to the item while it was checked out are discarded.
The same user that performed the checkout must discard it. Another alternative is to use application permissions
"""
qry = ServiceOperationQuery(self, "discardCheckout")
self.context.add_query(qry)
return self

def extract_sensitivity_labels(self):
# type: () -> ClientResult[ExtractSensitivityLabelsResult]
"""
Expand Down
4 changes: 2 additions & 2 deletions office365/onedrive/sitepages/canvas_layout.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from office365.entity import Entity
from office365.entity_collection import EntityCollection
from office365.onedrive.sitepages.horizontal_section import HorizontalSection
from office365.onedrive.sitepages.vertical_section import VerticalSection
from office365.onedrive.sitepages.sections.horizontal import HorizontalSection
from office365.onedrive.sitepages.sections.vertical import VerticalSection
from office365.runtime.paths.resource_path import ResourcePath


Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from office365.entity import Entity
from office365.entity_collection import EntityCollection
from office365.onedrive.sitepages.horizontal_section_column import (
from office365.onedrive.sitepages.sections.horizontal_column import (
HorizontalSectionColumn,
)
from office365.runtime.paths.resource_path import ResourcePath
Expand Down
5 changes: 5 additions & 0 deletions office365/onedrive/sitepages/webparts/position.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from office365.runtime.client_value import ClientValue


class WebPartPosition(ClientValue):
"""Represents the position information of the given web part to the current page"""
12 changes: 12 additions & 0 deletions office365/onedrive/sitepages/webparts/web_part.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
from office365.entity import Entity
from office365.onedrive.sitepages.webparts.position import WebPartPosition
from office365.runtime.client_result import ClientResult
from office365.runtime.queries.service_operation import ServiceOperationQuery


class WebPart(Entity):
"""Represents a specific web part instance on a SharePoint page."""

def get_position_of_web_part(self):
"""Returns the position of the specified web part in the page."""
return_type = ClientResult(self.context, WebPartPosition())
qry = ServiceOperationQuery(
self, "getPositionOfWebPart", return_type=return_type
)
self.context.add_query(qry)
return self

0 comments on commit 92fb43a

Please sign in to comment.