Skip to content

grants

CreateGrantRequest

Bases: TypedDict

Interface representing a request to create a grant.

Attributes:

Name Type Description
provider Provider

OAuth provider.

settings Dict[str, Any]

Settings required by provider.

state NotRequired[str]

Optional state value to return to developer's website after authentication flow is completed.

scope NotRequired[List[str]]

Optional list of scopes to request. If not specified it will use the integration default scopes.

Source code in nylas/models/grants.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
class CreateGrantRequest(TypedDict):
    """
    Interface representing a request to create a grant.

    Attributes:
        provider: OAuth provider.
        settings: Settings required by provider.
        state: Optional state value to return to developer's website after authentication flow is completed.
        scope: Optional list of scopes to request. If not specified it will use the integration default scopes.
    """

    provider: Provider
    settings: Dict[str, Any]
    state: NotRequired[str]
    scope: NotRequired[List[str]]

Grant dataclass

Interface representing a Nylas Grant object.

Attributes:

Name Type Description
id str

Globally unique object identifier.

provider str

OAuth provider that the user authenticated with.

scope List[str]

Scopes specified for the grant.

created_at Optional[int]

Unix timestamp when the grant was created.

grant_status Optional[str]

Status of the grant, if it is still valid or if the user needs to re-authenticate.

email Optional[str]

Email address associated with the grant.

user_agent Optional[str]

End user's client user agent.

ip Optional[str]

End user's client IP address.

state Optional[str]

Initial state that was sent as part of the OAuth request.

updated_at Optional[int]

Unix timestamp when the grant was updated.

provider_user_id Optional[str]

Provider's ID for the user this grant is associated with.

settings Optional[Dict[str, Any]]

Settings required by the provider that were sent as part of the OAuth request.

Source code in nylas/models/grants.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@dataclass_json
@dataclass
class Grant:
    """
    Interface representing a Nylas Grant object.

    Attributes:
        id: Globally unique object identifier.
        provider: OAuth provider that the user authenticated with.
        scope: Scopes specified for the grant.
        created_at: Unix timestamp when the grant was created.
        grant_status: Status of the grant, if it is still valid or if the user needs to re-authenticate.
        email: Email address associated with the grant.
        user_agent: End user's client user agent.
        ip: End user's client IP address.
        state: Initial state that was sent as part of the OAuth request.
        updated_at: Unix timestamp when the grant was updated.
        provider_user_id: Provider's ID for the user this grant is associated with.
        settings: Settings required by the provider that were sent as part of the OAuth request.
    """

    id: str
    provider: str
    scope: List[str] = field(default_factory=list)
    grant_status: Optional[str] = None
    email: Optional[str] = None
    user_agent: Optional[str] = None
    ip: Optional[str] = None
    state: Optional[str] = None
    created_at: Optional[int] = None
    updated_at: Optional[int] = None
    provider_user_id: Optional[str] = None
    settings: Optional[Dict[str, Any]] = None

ListGrantsQueryParams

Bases: TypedDict

Interface representing the query parameters for listing grants.

Attributes:

Name Type Description
limit NotRequired[int]

The maximum number of objects to return. This field defaults to 10. The maximum allowed value is 200.

offset NotRequired[int]

Offset grant results by this number.

sortBy NotRequired[str]

Sort entries by field name

orderBy NotRequired[str]

Specify ascending or descending order.

since NotRequired[int]

Scope grants from a specific point in time by Unix timestamp.

before NotRequired[int]

Scope grants to a specific point in time by Unix timestamp.

email NotRequired[str]

Filtering your query based on grant email address (if applicable)

grantStatus NotRequired[str]

Filtering your query based on grant email status (if applicable)

ip NotRequired[str]

Filtering your query based on grant IP address

provider NotRequired[Provider]

Filtering your query based on OAuth provider

Source code in nylas/models/grants.py
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
class ListGrantsQueryParams(TypedDict):
    """
    Interface representing the query parameters for listing grants.

    Attributes:
        limit: The maximum number of objects to return.
            This field defaults to 10. The maximum allowed value is 200.
        offset: Offset grant results by this number.
        sortBy: Sort entries by field name
        orderBy: Specify ascending or descending order.
        since: Scope grants from a specific point in time by Unix timestamp.
        before: Scope grants to a specific point in time by Unix timestamp.
        email: Filtering your query based on grant email address (if applicable)
        grantStatus: Filtering your query based on grant email status (if applicable)
        ip: Filtering your query based on grant IP address
        provider: Filtering your query based on OAuth provider
    """

    limit: NotRequired[int]
    offset: NotRequired[int]
    sortBy: NotRequired[str]
    orderBy: NotRequired[str]
    since: NotRequired[int]
    before: NotRequired[int]
    email: NotRequired[str]
    grantStatus: NotRequired[str]
    ip: NotRequired[str]
    provider: NotRequired[Provider]

UpdateGrantRequest

Bases: TypedDict

Interface representing a request to update a grant.

Attributes:

Name Type Description
settings NotRequired[Dict[str, Any]]

Settings required by provider.

scope NotRequired[List[str]]

List of integration scopes for the grant.

Source code in nylas/models/grants.py
62
63
64
65
66
67
68
69
70
71
72
class UpdateGrantRequest(TypedDict):
    """
    Interface representing a request to update a grant.

    Attributes:
        settings: Settings required by provider.
        scope: List of integration scopes for the grant.
    """

    settings: NotRequired[Dict[str, Any]]
    scope: NotRequired[List[str]]