Skip to content

Query

Operator

Bases: Enum

Enumeration representing comparison operators for a query string.

More information here: https://developers.google.com/drive/api/v3/ref-search-terms#operators

Source code in pygsuite/drive/query.py
class Operator(Enum):
    """Enumeration representing comparison operators for a query string.

    More information here: https://developers.google.com/drive/api/v3/ref-search-terms#operators
    """

    CONTAINS = "contains"
    NOT_CONTAINS = "not {} contains"
    EQUAL = "="
    NOT_EQUAL = "!="
    LESS_THAN = "<"
    LESS_THAN_OR_EQUAL = "<="
    GREATER_THAN = ">"
    GREATER_THAN_OR_EQUAL = ">="
    IN = "in"
    AND = "and"
    OR = "or"
    NOT = "not"
    HAS = "has"

    @classmethod
    def _missing_(cls, value):
        raise ValueError(
            f"{value} is an unsupported operator. Please see the docs for supported operators: "
            "https://developers.google.com/drive/api/v3/ref-search-terms"
        )

QueryTerm

Bases: Enum

Enumeration representing query term fields that can be searched.

More information here: https://developers.google.com/drive/api/v3/ref-search-terms#file_properties

Source code in pygsuite/drive/query.py
class QueryTerm(Enum):
    """Enumeration representing query term fields that can be searched.

    More information here: https://developers.google.com/drive/api/v3/ref-search-terms#file_properties
    """

    NAME = "name"
    TEXT = "fullText"
    MIMETYPE = "mimeType"
    MODIFIED_TIME = "modifiedTime"
    LAST_VIEWED_TIME = "viewedByMeTime"
    TRASHED = "trashed"
    STARRED = "starred"
    PARENTS = "parents"
    OWNERS = "owners"
    WRITERS = "writers"
    READERS = "readers"
    SHARED_WITH_ME = "sharedWithMe"
    CREATED_TIME = "createdTime"
    PROPERTIES = "properties"
    ADD_PROPERTIES = "addProperties"
    VISIBILITY = "visibility"
    SHORTCUT_DETAILS_TARGET_ID = "shortcutDetails.targetId"
    # drive-specific query terms
    HIDDEN = "hidden"
    MEMBER_COUNT = "memberCount"
    ORGANIZER_COUNT = "organizerCount"

    @classmethod
    def _missing_(cls, value):
        raise ValueError(
            f"{value} is an unsupported query term. Please see the docs for supported query terms: "
            "https://developers.google.com/drive/api/v3/ref-search-terms"
        )