<filename>tdameritrade_api/profile/__init__.py<gh_stars>1-10
#!/usr/bin/python
##-------------------------------##
## TDAmeritrade PyAPI            ##
## Written By: <NAME>        ##
##-------------------------------##
## Profile Class                 ##
##-------------------------------##

## Imports
from __future__ import annotations

from ..utils import urls
from ..session import Session

## Constants
__all__ = [
    "Profile"
]


## Classes
class Profile:
    """TDAmeritrade Profile"""

    # -Constructor
    def __init__(self, session: Session) -> Profile:
        self._session: Session = session

    # -Instance Methods
    async def me(
        self, *, preferences: bool = True, surrogates: bool = True,
        streamer_info: bool = True, streamer_keys: bool = True
    ) -> dict[str, str]:
        '''Profile details'''
        fields = []
        if preferences:
            fields.append("preferences")
        if surrogates:
            fields.append("surrogateIds")
        if streamer_info:
            fields.append("streamerConnectionInfo")
        if streamer_keys:
            fields.append("streamerSubscriptionKeys")
        return await self._session.get(urls.user_principals, params={
            'fields': ','.join(fields)
        })

<filename>tdameritrade_api/profile/__init__.py<gh_stars>1-10
#!/usr/bin/python
##-------------------------------##
## TDAmeritrade PyAPI            ##
## Written By: <NAME>        ##
##-------------------------------##
## Profile Class                 ##
##-------------------------------##

## Imports
from __future__ import annotations

from ..utils import urls
from ..session import Session

## Constants
__all__ = [
    "Profile"
]


## Classes
class Profile:
    """TDAmeritrade Profile"""

    # -Constructor
    def __init__(self, session: Session) -> Profile:
        self._session: Session = session

    # -Instance Methods
    async def me(
        self, *, preferences: bool = True, surrogates: bool = True,
        streamer_info: bool = True, streamer_keys: bool = True
    ) -> dict[str, str]:
        '''Profile details'''
        fields = []
        if preferences:
            fields.append("preferences")
        if surrogates:
            fields.append("surrogateIds")
        if streamer_info:
            fields.append("streamerConnectionInfo")
        if streamer_keys:
            fields.append("streamerSubscriptionKeys")
        return await self._session.get(urls.user_principals, params={
            'fields': ','.join(fields)
        })

#!/usr/bin/python ##-------------------------------## ## TDAmeritrade PyAPI            ## ## Written By: <NAME>        ## ##-------------------------------## ## Profile Class                 ## ##-------------------------------## ## Imports ## Constants ## Classes TDAmeritrade Profile # -Constructor # -Instance Methods Profile details