Module libnova.common.api.User

Expand source code
#!/usr/bin/env python
# coding: utf-8

import datetime
from enum import Enum
from libnova.common import api

# Define Enum structs
from libnova.common.api.Serializable import Serializable


# Define main object structure
class User(Serializable):
    """User

    The main methods allows the interaction with the main structures related to users in the platform
    """

    id:            int = 0
    api_key:       str
    active:        bool
    name:          str
    email:         str
    password:      str
    password_date: datetime.datetime
    remember_code: str
    last_login:    datetime.datetime
    date_create:   datetime.datetime
    date_online:   datetime.datetime

#Define main functions as "static"


def get(id) -> User:
    """Retrieve a User by its `id`

    Args:
        id (int): The `User` id

    Returns:
        User: A `User` if exists
    """

    api_driver = api.Driver.get_instance()
    return api_driver.serialize(
        api_driver.get(
            url_segment='user/internal/' + str(id)
        ),
        User
    )


if __name__ == "__main__":
    print('This file cannot be executed directly!')

Functions

def get(id) ‑> User

Retrieve a User by its id

Args

id : int
The User id

Returns

User
A User if exists
Expand source code
def get(id) -> User:
    """Retrieve a User by its `id`

    Args:
        id (int): The `User` id

    Returns:
        User: A `User` if exists
    """

    api_driver = api.Driver.get_instance()
    return api_driver.serialize(
        api_driver.get(
            url_segment='user/internal/' + str(id)
        ),
        User
    )

Classes

class User (**entries: dict)

User

The main methods allows the interaction with the main structures related to users in the platform

Expand source code
class User(Serializable):
    """User

    The main methods allows the interaction with the main structures related to users in the platform
    """

    id:            int = 0
    api_key:       str
    active:        bool
    name:          str
    email:         str
    password:      str
    password_date: datetime.datetime
    remember_code: str
    last_login:    datetime.datetime
    date_create:   datetime.datetime
    date_online:   datetime.datetime

Ancestors

Class variables

var active : bool
var api_key : str
var date_create : datetime.datetime
var date_online : datetime.datetime
var email : str
var id : int
var last_login : datetime.datetime
var name : str
var password : str
var password_date : datetime.datetime
var remember_code : str