def user_entity_handler(user_id): """Get profile of a user with a specified UUID. **Request Example:** .. code-block:: bash $ curl https://critiquebrainz.org/ws/1/user/ae5a003f-292c-497e-afbd-8076e9626f2e \\ -X GET **Response Example:** .. code-block:: json { "user": { "created": "Wed, 07 May 2014 14:47:03 GMT", "display_name": "User's Name comes here", "id": "ae5a003f-292c-497e-afbd-8076e9626f2e", "karma": 0, "user_type": "Noob" } } :resheader Content-Type: *application/json* """ user = db_users.get_by_id(str(user_id)) if not user: raise NotFound("Can't find a user with ID: {user_id}".format(user_id=user_id)) inc = Parser.list('uri', 'inc', User.allowed_includes, optional=True) or [] return jsonify(user=User(user).to_dict(inc))
def user_me_handler(user): """Get your profile information. **Request Example:** .. code-block:: bash $ curl "https://critiquebrainz.org/ws/1/user/me" \\ -X GET \\ -H "Authorization: Bearer <access token>" **Response Example:** .. code-block:: json { "user": { "display_name": "your_display_name", "created": "Fri, 02 Dec 2016 19:02:47 GMT", "show_gravatar": true, "user_type": "Noob", "email": "your_email_id", "karma": 0, "musicbrainz_username": "******", "id": "your-unique-user-id", "avatar": "https://gravatar.com/your-gravatar-link" } } :query inc: includes :resheader Content-Type: *application/json* """ inc = Parser.list('uri', 'inc', User.allowed_includes, optional=True) or [] return jsonify(user=user.to_dict(inc, confidential=True))
def user_entity_handler(user_id): """Get profile of a user with a specified UUID. **Request Example:** .. code-block:: bash $ curl https://critiquebrainz.org/ws/1/user/ae5a003f-292c-497e-afbd-8076e9626f2e \\ -X GET **Response Example:** .. code-block:: json { "user": { "created": "Wed, 07 May 2014 14:47:03 GMT", "display_name": "User's Name comes here", "id": "ae5a003f-292c-497e-afbd-8076e9626f2e", "karma": 0, "user_type": "Noob" } } :resheader Content-Type: *application/json* """ user = db_users.get_by_id(str(user_id)) if not user: raise NotFound( "Can't find a user with ID: {user_id}".format(user_id=user_id)) inc = Parser.list('uri', 'inc', User.allowed_includes, optional=True) or [] return jsonify(user=User(user).to_dict(inc))
def user_me_handler(user): """Get your profile information. **Request Example:** .. code-block:: bash $ curl "https://critiquebrainz.org/ws/1/user/me" \\ -X GET \\ -H "Authorization: Bearer <access token>" **Response Example:** .. code-block:: json { "user": { "display_name": "your_display_name", "created": "Fri, 02 Dec 2016 19:02:47 GMT", "show_gravatar": true, "user_type": "Noob", "email": "your_email_id", "karma": 0, "musicbrainz_username": "******", "id": "your-unique-user-id", "avatar": "https:\/\/gravatar.com\/your-gravatar-link" } } :query inc: includes :resheader Content-Type: *application/json* """ inc = Parser.list('uri', 'inc', User.allowed_includes, optional=True) or [] return jsonify(user=user.to_dict(inc, confidential=True))
def user_entity_handler(user_id): """Get profile of a user with a specified UUID. :resheader Content-Type: *application/json* """ user = User.query.get_or_404(str(user_id)) inc = Parser.list('uri', 'inc', User.allowed_includes, optional=True) or [] return jsonify(user=user.to_dict(inc))
def user_me_handler(user): """Get your profile information. :query inc: includes :resheader Content-Type: *application/json* """ inc = Parser.list('uri', 'inc', User.allowed_includes, optional=True) or [] return jsonify(user=user.to_dict(inc, confidential=True))