Skip to content

Latest commit

 

History

History
247 lines (169 loc) · 9.52 KB

UserApi.md

File metadata and controls

247 lines (169 loc) · 9.52 KB

flat_api.UserApi

All URIs are relative to https://api.flat.io/v2

Method HTTP request Description
get_user GET /users/{user} Get a public user profile
get_user_likes GET /users/{user}/likes List liked scores
get_user_scores GET /users/{user}/scores List user's scores

get_user

UserPublic get_user(user)

Get a public user profile

Get a profile of a Flat or Flat for Education User.

Example

  • OAuth Authentication (OAuth2):
import flat_api
from flat_api.models.user_public import UserPublic
from flat_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.flat.io/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = flat_api.Configuration(
    host = "https://api.flat.io/v2"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Enter a context with an instance of the API client
with flat_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = flat_api.UserApi(api_client)
    user = 'user_example' # str | This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. 

    try:
        # Get a public user profile
        api_response = api_instance.get_user(user)
        print("The response of UserApi->get_user:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling UserApi->get_user: %s\n" % e)

Parameters

Name Type Description Notes
user str This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user.

Return type

UserPublic

Authorization

OAuth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 The user public details -
0 Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_user_likes

List[ScoreDetails] get_user_likes(user, next=next, previous=previous, limit=limit, ids=ids)

List liked scores

Example

  • OAuth Authentication (OAuth2):
import flat_api
from flat_api.models.score_details import ScoreDetails
from flat_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.flat.io/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = flat_api.Configuration(
    host = "https://api.flat.io/v2"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Enter a context with an instance of the API client
with flat_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = flat_api.UserApi(api_client)
    user = 'user_example' # str | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. 
    next = 'next_example' # str | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data.  (optional)
    previous = 'previous_example' # str | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data.  (optional)
    limit = 25 # int | This is the maximum number of objects that may be returned (optional) (default to 25)
    ids = True # bool | Return only the identifiers of the scores (optional)

    try:
        # List liked scores
        api_response = api_instance.get_user_likes(user, next=next, previous=previous, limit=limit, ids=ids)
        print("The response of UserApi->get_user_likes:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling UserApi->get_user_likes: %s\n" % e)

Parameters

Name Type Description Notes
user str Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user.
next str An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. [optional]
previous str An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. [optional]
limit int This is the maximum number of objects that may be returned [optional] [default to 25]
ids bool Return only the identifiers of the scores [optional]

Return type

List[ScoreDetails]

Authorization

OAuth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 List of liked scores -
0 Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_user_scores

List[ScoreDetails] get_user_scores(user, parent=parent)

List user's scores

Get the list of public scores owned by a User. DEPRECATED: Please note that the current behavior will be deprecrated on 2019-01-01. This method will no longer list private and shared scores, but only public scores of a Flat account. If you want to access to private scores, please use the Collections API instead.

Example

  • OAuth Authentication (OAuth2):
import flat_api
from flat_api.models.score_details import ScoreDetails
from flat_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.flat.io/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = flat_api.Configuration(
    host = "https://api.flat.io/v2"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Enter a context with an instance of the API client
with flat_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = flat_api.UserApi(api_client)
    user = 'user_example' # str | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. 
    parent = 'parent_example' # str | Filter the score forked from the score id `parent` (optional)

    try:
        # List user's scores
        api_response = api_instance.get_user_scores(user, parent=parent)
        print("The response of UserApi->get_user_scores:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling UserApi->get_user_scores: %s\n" % e)

Parameters

Name Type Description Notes
user str Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user.
parent str Filter the score forked from the score id `parent` [optional]

Return type

List[ScoreDetails]

Authorization

OAuth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 The user scores -
0 Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]