• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

box / box-python-sdk / 5081557984

pending completion
5081557984

push

github

GitHub
chore: release 3.7.2 (#817)

1 of 1 new or added line in 1 file covered. (100.0%)

3441 of 3679 relevant lines covered (93.53%)

0.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.85
/boxsdk/object/file_request.py
1
import json
1✔
2
from datetime import datetime
1✔
3
from typing import TYPE_CHECKING, Optional, Union
1✔
4

5
from boxsdk.util.datetime_formatter import normalize_date_to_rfc3339_format
1✔
6
from boxsdk.util.text_enum import TextEnum
1✔
7

8
from ..util.api_call_decorator import api_call
1✔
9
from .base_object import BaseObject
1✔
10

11
if TYPE_CHECKING:
1✔
12
    from boxsdk.object.folder import Folder
×
13

14

15
class StatusState(TextEnum):
1✔
16
    """An enum of possible status states"""
17
    ACTIVE = 'active'
1✔
18
    INACTIVE = 'inactive'
1✔
19

20

21
class FileRequest(BaseObject):
1✔
22
    """Represents the file request."""
23
    _item_type = 'file_request'
1✔
24

25
    @api_call
1✔
26
    def copy(
1✔
27
            self,
28
            *,
29
            folder: 'Folder',
30
            description: Optional[str] = None,
31
            expires_at: Union[datetime, str] = None,
32
            require_description: Optional[bool] = None,
33
            require_email: Optional[bool] = None,
34
            status: Optional[str] = None,
35
            title: Optional[str] = None,
36
            **_kwargs
37
    ) -> 'FileRequest':
38
        """Copy an existing file request already present on one folder, and applies it to another folder.
39

40
        :param description:
41
            A new description for the file request.
42
        :param title:
43
            A new title for the file request.
44
        :param expires_at:
45
            A expiration time for file request which no longer accepts new files.
46
        :param folder:
47
            The folder to which the file request will be saved.
48
        :param require_description:
49
            A flag indicating whether the file submitted must have a description.
50
        :param require_email:
51
            A flag indicating whether the file submitted must have sender email.
52
        :param status:
53
            The status of the file request.
54
        :returns:
55
            The copy of the file request
56
        """
57
        url = self.get_url('copy')
1✔
58
        data = {
1✔
59
            'folder': {'id': folder.object_id, 'type': folder.object_type},
60
        }
61
        if description is not None:
1✔
62
            data['description'] = description
×
63
        if title is not None:
1✔
64
            data['title'] = title
1✔
65
        if expires_at is not None:
1✔
66
            data['expires_at'] = normalize_date_to_rfc3339_format(expires_at)
1✔
67
        if require_description is not None:
1✔
68
            data['is_description_required'] = require_description
×
69
        if require_email is not None:
1✔
70
            data['is_email_required'] = require_email
×
71
        if status is not None:
1✔
72
            data['status'] = status
×
73
        box_response = self._session.post(url, data=json.dumps(data))
1✔
74
        response = box_response.json()
1✔
75
        return self.translator.translate(
1✔
76
            session=self._session,
77
            response_object=response,
78
        )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc