Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# coding: utf-8
from __future__ import unicode_literals, absolute_import
import json
from boxsdk.util.text_enum import TextEnum
from .base_object import BaseObject
from ..pagination.limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
from ..util.api_call_decorator import api_call
from ..util.default_arg_value import SDK_VALUE_NOT_SET
class GroupRole(TextEnum):
"""The role in the group."""
ADMIN = 'admin'
MEMBER = 'member'
class Group(BaseObject):
"""Represents a Box group."""
_item_type = 'group'
@api_call
def get_memberships(self, limit=None, offset=None, fields=None):
"""
Get the membership records for the group, which indicate which users are included in the group.
:param offset:
import json
from boxsdk.util.text_enum import TextEnum
from .base_object import BaseObject
from ..exception import (
BoxAPIException,
BoxValueError
)
from .metadata import Metadata
from ..util.api_call_decorator import api_call
from ..util.default_arg_value import SDK_VALUE_NOT_SET
from ..pagination.marker_based_dict_collection import MarkerBasedDictCollection
from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
class ClassificationType(TextEnum):
"""An enum of possible classification types"""
PUBLIC = 'Public'
INTERNAL = 'Internal'
CONFIDENTIAL = 'Confidential'
NONE = 'None'
class Item(BaseObject):
"""Box API endpoint for interacting with files and folders."""
_classification_template_key = 'securityClassification-6VMVochwUWo'
def _get_accelerator_upload_url(self, file_id=None):
"""
Make an API call to get the Accelerator upload url for either upload a new file or updating an existing file.
# coding: utf-8
from __future__ import unicode_literals, absolute_import
import json
from .base_endpoint import BaseEndpoint
from ..pagination.limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
from ..util.api_call_decorator import api_call
from ..util.text_enum import TextEnum
class SearchScope(TextEnum):
"""Enum of possible serach scopes."""
USER = 'user_content'
ENTERPRISE = 'enterprise_content'
class TrashContent(TextEnum):
"""Enum of trash content values."""
NONE = 'non_trashed_only'
ONLY = 'trashed_only'
class MetadataSearchFilter(object):
"""
Helper class to encapsulate a single search filter. A search filter can only search against one template,
but can filter on many fields.
See :class:`MetadataSearchFilters`.
from threading import Lock
# pylint:disable=import-error,no-name-in-module,relative-import
from six.moves.urllib.parse import urlencode, urlunsplit
# pylint:enable=import-error,no-name-in-module,relative-import
import six
from ..config import API
from ..exception import BoxOAuthException, BoxAPIException
from ..object.base_api_json_object import BaseAPIJSONObject
from ..session.session import Session
from ..util.json import is_json_response
from ..util.text_enum import TextEnum
class TokenScope(TextEnum):
""" Scopes used for a downscope token request.
See https://developer.box.com/en/guides/authentication/access-tokens/downscope/.
"""
ITEM_READ = 'item_read'
ITEM_READWRITE = 'item_readwrite'
ITEM_PREVIEW = 'item_preview'
ITEM_UPLOAD = 'item_upload'
ITEM_SHARE = 'item_share'
ITEM_DELETE = 'item_delete'
ITEM_DOWNLOAD = 'item_download'
class TokenResponse(BaseAPIJSONObject):
""" Represents the response for a token request. """
pass
# coding: utf-8
from __future__ import unicode_literals, absolute_import
import json
from .base_endpoint import BaseEndpoint
from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
from ..util.api_call_decorator import api_call
from ..util.text_enum import TextEnum
class WhitelistDirection(TextEnum):
"""
Used to determine the direction of the whitelist.
"""
INBOUND = 'inbound'
OUTBOUNT = 'outbound'
BOTH = 'both'
class CollaborationWhitelist(BaseEndpoint):
"""Represents the whitelist of email domains that users in an enterprise may collaborate with."""
@api_call
def get_entries(self, limit=None, marker=None, fields=None):
"""
Get the entries in the collaboration whitelist using limit-offset paging.
'fieldKey': field_key,
})
def add_operation(self, operation):
"""
Adds an update operation.
:param operation:
The operation to add.
:type operation:
`dict`
"""
self._ops.append(operation)
class MetadataFieldType(TextEnum):
STRING = 'string'
DATE = 'date'
ENUM = 'enum'
MULTISELECT = 'multiSelect'
FLOAT = 'float'
class MetadataField(object):
"""Represents a metadata field when creating or updating a metadata template."""
def __init__(self, field_type, display_name, key=None, options=None):
"""
:param field_type:
The type of the metadata field
:type field_type:
:class:`MetadataFieldType`
import json
from .base_endpoint import BaseEndpoint
from ..pagination.limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
from ..util.api_call_decorator import api_call
from ..util.text_enum import TextEnum
class SearchScope(TextEnum):
"""Enum of possible serach scopes."""
USER = 'user_content'
ENTERPRISE = 'enterprise_content'
class TrashContent(TextEnum):
"""Enum of trash content values."""
NONE = 'non_trashed_only'
ONLY = 'trashed_only'
class MetadataSearchFilter(object):
"""
Helper class to encapsulate a single search filter. A search filter can only search against one template,
but can filter on many fields.
See :class:`MetadataSearchFilters`.
"""
def __init__(self, template_key, scope):
"""
:param template_key:
The key of the template to search on
:type template_key:
# coding: utf-8
from __future__ import unicode_literals, absolute_import
from boxsdk.object.base_object import BaseObject
from boxsdk.util.text_enum import TextEnum
from ..util.api_call_decorator import api_call
class CollaborationRole(TextEnum):
"""An enum of possible collaboration roles"""
EDITOR = 'editor'
VIEWER = 'viewer'
# Available to enterprise accounts:
PREVIEWER = 'previewer'
UPLOADER = 'uploader'
PREVIEWER_UPLOADER = 'previewer uploader'
VIEWER_UPLOADER = 'viewer uploader'
CO_OWNER = 'co-owner'
OWNER = 'owner'
class CollaborationStatus(TextEnum):
"""An enum of possible statuses of a collaboration"""
PENDING = 'pending'
class CollaborationRole(TextEnum):
"""An enum of possible collaboration roles"""
EDITOR = 'editor'
VIEWER = 'viewer'
# Available to enterprise accounts:
PREVIEWER = 'previewer'
UPLOADER = 'uploader'
PREVIEWER_UPLOADER = 'previewer uploader'
VIEWER_UPLOADER = 'viewer uploader'
CO_OWNER = 'co-owner'
OWNER = 'owner'
class CollaborationStatus(TextEnum):
"""An enum of possible statuses of a collaboration"""
PENDING = 'pending'
ACCEPTED = 'accepted'
REJECTED = 'rejected'
class Collaboration(BaseObject):
"""An object that represents a collaboration between a folder and an individual or group"""
_item_type = 'collaboration'
@api_call
def update_info(self, role=None, status=None):
"""Edit an existing collaboration on Box
:param role:
The new role for this collaboration or None to leave unchanged
from __future__ import unicode_literals
import json
import os
from six import text_type
from boxsdk.object.group import Group
from boxsdk.object.item import Item
from boxsdk.object.user import User
from boxsdk.pagination.limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
from boxsdk.pagination.marker_based_object_collection import MarkerBasedObjectCollection
from boxsdk.util.api_call_decorator import api_call
from boxsdk.util.text_enum import TextEnum
class FolderSyncState(TextEnum):
"""An enum of all possible values of a folder's ``sync_state`` attribute.
The value of the ``sync_state`` attribute determines whether the folder
will be synced by sync clients.
"""
IS_SYNCED = 'synced'
NOT_SYNCED = 'not_synced'
PARTIALLY_SYNCED = 'partially_synced'
class _CollaborationType(TextEnum):
"""The type of a collaboration"""
USER = 'user'
GROUP = 'group'