예제 #1
0
def get_object_types() -> RespT:
    """Add or update ObjectType.
    ---
    get:
        tags:
        - ObjectType
        summary: Gets all object types id and description.
        responses:
            200:
              description: Success
              content:
                application/json:
                  schema:
                    type: array
                    items:
                      $ref: IdDesc
    """

    ret: List[JsonType] = []

    for obj_type in OBJECT_TYPES.values():
        assert obj_type.created
        assert obj_type.modified
        ret.append(
            common.IdDesc(obj_type.id, "", obj_type.created, obj_type.modified,
                          obj_type.description).to_dict())

    return jsonify(ret)
예제 #2
0
def get_scenes() -> RespT:
    """Add or update scene.
    ---
    get:
        tags:
        - Scene
        summary: Gets all scenes id and description.
        responses:
            200:
              description: Success
              content:
                application/json:
                  schema:
                    type: array
                    items:
                      $ref: IdDesc
    """

    ret: List[JsonType] = []

    for scene in SCENES.values():
        assert scene.created
        assert scene.modified
        ret.append(
            common.IdDesc(scene.id, scene.name, scene.created, scene.modified,
                          scene.description).to_dict())

    return jsonify(ret)
예제 #3
0
def get_projects() -> RespT:
    """Add or update project.
    ---
    get:
        tags:
        - Project
        summary: Gets all projects id and description.
        responses:
            200:
              description: Success
              content:
                application/json:
                  schema:
                    type: array
                    items:
                      $ref: IdDesc
    """

    ret: List[JsonType] = []

    for proj in PROJECTS.values():
        assert proj.created
        assert proj.modified
        ret.append(
            common.IdDesc(proj.id, proj.name, proj.created, proj.modified,
                          proj.description).to_dict())

    return jsonify(ret)
예제 #4
0
def get_service_types():
    """Add or update ServiceType.
        ---
        get:
            tags:
            - ServiceType
            summary: Gets all object types id and description.
            responses:
                '200':
                  description: Success
                  content:
                    application/json:
                      schema:
                        $ref: IdDescList
    """

    ret = common.IdDescList()

    for srv_type in SERVICE_TYPES.values():
        ret.items.append(common.IdDesc(srv_type.id, "", srv_type.desc))

    return jsonify(ret.to_dict())
예제 #5
0
def get_object_types():
    """Add or update ObjectType.
        ---
        get:
            tags:
            - ObjectType
            summary: Gets all object types id and description.
            responses:
                '200':
                  description: Success
                  content:
                    application/json:
                      schema:
                        $ref: IdDescList
    """

    ret = common.IdDescList()

    for obj_type in OBJECT_TYPES.values():
        ret.items.append(common.IdDesc(obj_type.id, "", obj_type.desc))

    return jsonify(ret.to_dict())
예제 #6
0
def get_scenes():
    """Add or update scene.
        ---
        get:
            tags:
            - Scene
            summary: Gets all scenes id and description.
            responses:
                '200':
                  description: Success
                  content:
                    application/json:
                      schema:
                        $ref: IdDescList
    """

    ret = common.IdDescList()

    for scene in SCENES.values():
        ret.items.append(common.IdDesc(scene.id, scene.name, scene.desc))

    return jsonify(ret.to_dict())
예제 #7
0
def get_projects():
    """Add or update project.
        ---
        get:
            tags:
            - Project
            summary: Gets all projects id and description.
            responses:
                '200':
                  description: Success
                  content:
                    application/json:
                      schema:
                        $ref: IdDescList
    """

    ret = common.IdDescList()

    for proj in PROJECTS.values():
        ret.items.append(common.IdDesc(proj.id, proj.name, proj.desc))

    return jsonify(ret.to_dict())