Skip to content

credentials

CredentialData = Union[MicrosoftAdminConsentSettings, GoogleServiceAccountCredential, Dict[str, any]] module-attribute

The alias for the different types of credential data that can be used to create a credential.

CredentialType = Literal['adminconsent', 'serviceaccount', 'connector'] module-attribute

The alias for the different types of credentials that can be created.

Credential dataclass

Interface representing a Nylas Credential object. Attributes id: Globally unique object identifier; name: Name of the credential credential_type: The type of credential hashed_data: Hashed value of the credential that you created created_at: Timestamp of when the credential was created updated_at: Timestamp of when the credential was updated;

Source code in nylas/models/credentials.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
@dataclass_json
@dataclass
class Credential:
    """
    Interface representing a Nylas Credential object.
    Attributes
    id: Globally unique object identifier;
    name: Name of the credential
    credential_type: The type of credential
    hashed_data: Hashed value of the credential that you created
    created_at: Timestamp of when the credential was created
    updated_at: Timestamp of when the credential was updated;
    """

    id: str
    name: str
    credential_type: Optional[CredentialType] = None
    hashed_data: Optional[str] = None
    created_at: Optional[int] = None
    updated_at: Optional[int] = None

CredentialRequest

Bases: TypedDict

Interface representing a request to create a credential.

Attributes:

Name Type Description
name Optional[str]

Name of the credential

credential_type CredentialType

Type of credential you want to create.

credential_data CredentialData

The data required to successfully create the credential object

Source code in nylas/models/credentials.py
67
68
69
70
71
72
73
74
75
76
77
78
79
class CredentialRequest(TypedDict):
    """
    Interface representing a request to create a credential.

    Attributes:
        name: Name of the credential
        credential_type: Type of credential you want to create.
        credential_data: The data required to successfully create the credential object
    """

    name: Optional[str]
    credential_type: CredentialType
    credential_data: CredentialData

GoogleServiceAccountCredential

Bases: Protocol

Interface representing the data required to create a Google Service Account credential.

Attributes:

Name Type Description
private_key_id str

The private key ID of the service account

private_key str

The private key of the service account

client_email str

The client email of the service account

Source code in nylas/models/credentials.py
46
47
48
49
50
51
52
53
54
55
56
57
58
class GoogleServiceAccountCredential(Protocol):
    """
    Interface representing the data required to create a Google Service Account credential.

    Attributes:
        private_key_id: The private key ID of the service account
        private_key: The private key of the service account
        client_email: The client email of the service account
    """

    private_key_id: str
    private_key: str
    client_email: str

ListCredentialQueryParams

Bases: TypedDict

Interface representing the query parameters for credentials .

Attributes:

Name Type Description
offset NotRequired[int]

Offset results

sort_by NotRequired[str]

Sort entries by field name

order_by NotRequired[str]

Order results by the specified field. Currently only start is supported.

limit NotRequired[int]

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

Source code in nylas/models/credentials.py
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
class ListCredentialQueryParams(TypedDict):
    """
    Interface representing the query parameters for credentials .

    Attributes:
        offset: Offset results
        sort_by: Sort entries by field name
        order_by: Order results by the specified field.
            Currently only start is supported.
        limit: The maximum number of objects to return.
            This field defaults to 50. The maximum allowed value is 200.
    """

    limit: NotRequired[int]
    offset: NotRequired[int]
    order_by: NotRequired[str]
    sort_by: NotRequired[str]

MicrosoftAdminConsentSettings

Bases: Protocol

Interface representing the data required to create a Microsoft Admin Consent credential.

Attributes:

Name Type Description
client_id str

The client ID of the Azure AD application

client_secret str

The client secret of the Azure AD application

Source code in nylas/models/credentials.py
33
34
35
36
37
38
39
40
41
42
43
class MicrosoftAdminConsentSettings(Protocol):
    """
    Interface representing the data required to create a Microsoft Admin Consent credential.

    Attributes:
        client_id: The client ID of the Azure AD application
        client_secret: The client secret of the Azure AD application
    """

    client_id: str
    client_secret: str

UpdateCredentialRequest

Bases: TypedDict

Interface representing a request to update a credential.

Attributes:

Name Type Description
name Optional[str]

Name of the credential

credential_data Optional[CredentialData]

The data required to successfully create the credential object

Source code in nylas/models/credentials.py
82
83
84
85
86
87
88
89
90
91
92
class UpdateCredentialRequest(TypedDict):
    """
    Interface representing a request to update a credential.

    Attributes:
        name: Name of the credential
        credential_data: The data required to successfully create the credential object
    """

    name: Optional[str]
    credential_data: Optional[CredentialData]