🔍 Code Extractor

class Entity_v1

Maturity: 32

Base entity

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/entity.py
Lines:
18 - 76
Complexity:
moderate

Purpose

Base entity

Source Code

class Entity(ClientObject[T]):
    """Base entity"""

    def update(self):
        # type: () -> Self
        """Updates the entity."""
        qry = UpdateEntityQuery(self)
        self.context.add_query(qry)
        return self

    def delete_object(self):
        # type: () -> Self
        """Deletes the entity."""
        qry = DeleteEntityQuery(self)
        self.context.add_query(qry)
        self.remove_from_parent_collection()
        return self

    @property
    def context(self):
        # type: () -> GraphClient
        """Return the Graph Client context."""
        return self._context

    @property
    def entity_type_name(self):
        # type: () -> str
        if self._entity_type_name is None:
            name = type(self).__name__
            self._entity_type_name = "microsoft.graph." + name[0].lower() + name[1:]
        return self._entity_type_name

    @property
    def id(self):
        # type: () -> Optional[str]
        """The unique identifier of the entity."""
        return self.properties.get("id", None)

    @property
    def property_ref_name(self):
        # type: () -> str
        return "id"

    def set_property(self, name, value, persist_changes=True):
        # type: (str, T, bool) -> Self
        super(Entity, self).set_property(name, value, persist_changes)
        if name == self.property_ref_name:
            if self._resource_path is None:
                if isinstance(self.parent_collection.resource_path, EntityPath):
                    self._resource_path = self.parent_collection.resource_path.patch(
                        value
                    )
                else:
                    self._resource_path = ResourcePath(
                        value, self.parent_collection.resource_path
                    )
            else:
                self._resource_path.patch(value)
        return self

Parameters

Name Type Default Kind
bases ClientObject[T] -

Parameter Details

bases: Parameter of type ClientObject[T]

Return Value

Returns unspecified type

Class Interface

Methods

update(self)

Purpose: Updates the entity.

Returns: None

delete_object(self)

Purpose: Deletes the entity.

Returns: None

context(self) property

Purpose: Return the Graph Client context.

Returns: See docstring for return details

entity_type_name(self) property

Purpose: Performs entity type name

Returns: None

id(self) property

Purpose: The unique identifier of the entity.

Returns: None

property_ref_name(self) property

Purpose: Performs property ref name

Returns: None

set_property(self, name, value, persist_changes)

Purpose: Sets property

Parameters:

  • name: Parameter
  • value: Parameter
  • persist_changes: Parameter

Returns: None

Required Imports

from typing import TYPE_CHECKING
from typing import Optional
from typing import TypeVar
from typing_extensions import Self
from office365.runtime.client_object import ClientObject

Usage Example

# Example usage:
# result = Entity(bases)

Tags

class entity

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class Entity 63.3% similar

    Base class for SharePoint entities that provides common operations like create, read, update, and delete (CRUD) functionality for SharePoint objects.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/entity.py
  • class OnenoteEntityBaseModel 59.1% similar

    OnenoteEntityBaseModel is a base class for OneNote entities that inherits from Entity. It serves as a foundational type for all OneNote-related entity models in the Office365 SDK.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/onenote/entity_base_model.py
  • class EntityCollection_v1 54.5% similar

    A collection container which represents a named collections of entities

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/entity_collection.py
  • class BaseItem 53.5% similar

    The baseItem resource is an abstract resource that contains a auth set of properties shared among several other resources types

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/base_item.py
  • class BaseCustomProperty 53.5% similar

    BaseCustomProperty is a SharePoint entity class representing a base custom property in the SharePoint Publishing REST API.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/publishing/customproperties/base.py
← Back to Browse