{"id":29572638,"url":"https://github.com/accelbyte/accelbyte-python-modular-sdk","last_synced_at":"2026-01-16T08:44:23.834Z","repository":{"id":208380293,"uuid":"721418311","full_name":"AccelByte/accelbyte-python-modular-sdk","owner":"AccelByte","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-14T00:23:08.000Z","size":49548,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-01-14T00:46:57.174Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AccelByte.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-11-21T02:42:00.000Z","updated_at":"2026-01-14T00:22:59.000Z","dependencies_parsed_at":"2024-10-23T06:22:35.540Z","dependency_job_id":"92f65aed-51f1-4c6a-a2c8-85c3bfdb5204","html_url":"https://github.com/AccelByte/accelbyte-python-modular-sdk","commit_stats":null,"previous_names":["accelbyte/accelbyte-python-modular-sdk"],"tags_count":733,"template":false,"template_full_name":null,"purl":"pkg:github/AccelByte/accelbyte-python-modular-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AccelByte%2Faccelbyte-python-modular-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AccelByte%2Faccelbyte-python-modular-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AccelByte%2Faccelbyte-python-modular-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AccelByte%2Faccelbyte-python-modular-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AccelByte","download_url":"https://codeload.github.com/AccelByte/accelbyte-python-modular-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AccelByte%2Faccelbyte-python-modular-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-19T05:10:41.993Z","updated_at":"2026-01-16T08:44:23.814Z","avatar_url":"https://github.com/AccelByte.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AccelByte Modular Python SDK\n\n\u003e :warning: **This [accelbyte-python-modular-sdk](https://github.com/AccelByte/accelbyte-python-modular-sdk) \n\u003e is not to be confused with [accelbyte-python-sdk](https://github.com/AccelByte/accelbyte-python-sdk):** \n\u003e * The former (modular SDK) is **experimental** and is planned to be the sucessor for the latter (monolithic SDK).\n\u003e * The modular SDK allows developers to include only the required modules in projects.\n\u003e * If you are starting a new project, you may try to use modular SDK.\n\u003e * If you use monolithic SDK in an existing project, a migration path is available via compatibility layer in modular SDK.\n\u003e * Both monolithic and modular SDK will be maintained for some time to give time for migration until monolithic SDK is deprecated in the future.\n\nA software development kit (SDK) for interacting with AccelByte Gaming Services (AGS) written in Python.\n\nThis SDK was generated from AGS OpenAPI spec files included in the [spec](spec) directory.\n\n## Setup\n\nThis SDK requires Python 3.9 to be installed.\n\n### Install with Pip\n\nInstall the core package from PyPI\n\n```sh\npip install accelbyte-py-sdk-core\n```\n\nand then install the service you need\n\n```sh\npip install accelbyte-py-sdk-service-achievement\npip install accelbyte-py-sdk-service-ams\npip install accelbyte-py-sdk-service-basic\npip install accelbyte-py-sdk-service-cloudsave\npip install accelbyte-py-sdk-service-gametelemetry\npip install accelbyte-py-sdk-service-gdpr\npip install accelbyte-py-sdk-service-iam\npip install accelbyte-py-sdk-service-leaderboard\npip install accelbyte-py-sdk-service-legal\npip install accelbyte-py-sdk-service-lobby\npip install accelbyte-py-sdk-service-match2\npip install accelbyte-py-sdk-service-platform\npip install accelbyte-py-sdk-service-reporting\npip install accelbyte-py-sdk-service-seasonpass\npip install accelbyte-py-sdk-service-session\npip install accelbyte-py-sdk-service-sessionhistory\npip install accelbyte-py-sdk-service-social\npip install accelbyte-py-sdk-service-ugc\n```\n\nand then install any feature you want\n\n```sh\npip install accelbyte-py-sdk-feat-auth\npip install accelbyte-py-sdk-feat-token-validation\n```\n\nor install everything\n\n```sh\npip install accelbyte-py-sdk-all\n   ```\n\n### Environment Variables\n\nThe following environment variables need to be set when using `EnvironmentConfigRepository` (default).\n\n| Name             | Required                                                                               | Example                          |\n|------------------|----------------------------------------------------------------------------------------|----------------------------------|\n| AB_BASE_URL      | Yes                                                                                    | https://test.accelbyte.io        |\n| AB_CLIENT_ID     | Yes                                                                                    | abcdef0123456789abcdef0123456789 |\n| AB_CLIENT_SECRET | Yes, only if you use a private `AB_CLIENT_ID`                                          | ab#c,d)ef(ab#c,d)ef(ab#c,d)ef(ab |\n| AB_NAMESPACE     | Yes, the SDK will automatically fill up the `{namespace}` path parameter (overridable) | accelbyte                        |\n| AB_APP_NAME      | No, the SDK will automatically fill up the `User-Agent` header (overridable)           | MyApp                            |\n| AB_APP_VERSION   | No, the SDK will automatically fill up the `User-Agent` header (overridable)           | 1.0.0                            |\n\n\n## Usage\n\n### Initializing\n\nYou'll have to initialize the SDK using the `initialize()` function.\n\n```python\nimport accelbyte_py_sdk\n\n\nif __name__ == \"__main__\":\n    accelbyte_py_sdk.initialize()\n    # uses EnvironmentConfigRepository by default\n    #   which in turn uses '$AB_BASE_URL', '$AB_CLIENT_ID', '$AB_CLIENT_SECRET', '$AB_NAMESPACE'\n```\n\nYou could also pass in options like so:\n\n```python\nfrom os import environ\nimport accelbyte_py_sdk\nfrom accelbyte_py_sdk.core import MyConfigRepository\n\n\nif __name__ == \"__main__\":\n    base_url = environ[\"MY_BASE_URL\"]\n    client_id = environ[\"MY_CLIENT_ID\"]\n    client_secret = environ[\"MY_CLIENT_SECRET\"]\n    namespace = environ[\"MY_NAMESPACE\"]\n    app_name = environ[\"MY_APP_NAME\"]\n    app_version = environ[\"MY_APP_VERSION\"]\n\n    my_config_repository = MyConfigRepository(\n        base_url=base_url,\n        client_id=client_id,\n        client_secret=client_secret,\n        namespace=namespace,\n        app_name=app_name,\n        app_version=app_version\n    )\n    options = {\n        \"config\": my_config_repository\n    }\n\n    accelbyte_py_sdk.initialize(options)\n    # you could still set some of these options after initializing.\n    # ex. accelbyte_py_sdk.core.set_config_repository(my_config_repository)\n\n```\n\n### Logging In and Logging Out\n\n#### Login using Username and Password\n\n```python\nfrom os import environ\n\nimport accelbyte_py_sdk\nfrom accelbyte_py_sdk.services.auth.v2 import login_user, logout\n\n\nif __name__ == \"__main__\":\n    accelbyte_py_sdk.initialize()\n\n    username = environ[\"AB_USERNAME\"]\n    password = environ[\"AB_PASSWORD\"]\n\n    token, error = login_user(username, password)\n    assert error is None\n\n    _, error = logout()\n    assert error is None\n\n```\n\nHere `login_user(username, password)` and `logout()` are wrapper functions.\n\nYou can also specify the scope you want for `login_user(...)`. With the `scope` parameter typed as `Optional[Union[str, List[str]]]`. By default the scope used is `commerce account social publishing analytics` (a space seprated value string).\n\n```python\nlogin_user(username, password, scope=\"scopeA\")\n# login_user(username, password, scope=\"scopeA scopeB\")  # space separated values\n# login_user(username, password, scope=[\"scopeA\", \"scopeB\"])\n```\n\n#### Login using OAuth Client (Public or Confidential)\n\n```python\nfrom os import environ\nimport accelbyte_py_sdk\nfrom accelbyte_py_sdk.services.auth.v2 import login_client\n\n\nif __name__ == \"__main__\":\n    accelbyte_py_sdk.initialize()\n\n    client_id = environ[\"AB_CLIENT_ID\"]\n    client_secret = environ[\"AB_CLIENT_SECRET\"]\n\n    token, error = login_client(client_id, client_secret)\n    # passing '$AB_CLIENT_ID' and '$AB_CLIENT_SECRET' is same as:\n    # token, error = login_client()\n    assert error is not None\n\n```\n\n:bulb: The use of a Public OAuth Client is highly discouraged for this use case. Please ensure that you both set the Client ID and Client Secret.\n\n#### Refreshing Tokens\n\n##### Background Token Refresh\n\nTo use background token refresh, use the `accelbyte_py_sdk.services.auth.v2.enable_background_refresh(...)`.\n\n```python\nfrom accelbyte_py_sdk import AccelByteSDK\nfrom accelbyte_py_sdk.services.auth.v2 import BackgroundOptions, enable_background_refresh \n\n\nsdk = AccelByteSDK()\n\nenable_background_refresh(\n   sdk=sdk,\n   options=BackgroundOptions(enabled=True, max_retry=2, refresh_rate=0.8, interval=10),\n)\n```\n\n##### On-demand Token Refresh\n\nTo use on-demand token refresh, use the `accelbyte_py_sdk.services.auth.v2.enable_on_demand_refresh(...)`.\n\n```python\nfrom accelbyte_py_sdk import AccelByteSDK\nfrom accelbyte_py_sdk.services.auth.v2 import OnDemandOptions, enable_on_demand_refresh \n\n\nsdk = AccelByteSDK()\n\nenable_on_demand_refresh(\n   sdk=sdk,\n   options=OnDemandOptions(enabled=True, max_retry=2, refresh_rate=0.8),\n)\n```\n\nThis configuration involves checking for the presence of an existing token, verifying its expiration status.\nIf the token has expired, the SDK will then examine whether a refresh token exists.\nIf a refresh token is available, it will be utilized to obtain a new token.\n\n##### Manual Token Refresh\n\nTo manually refresh the token:\n\n```python\nfrom accelbyte_py_sdk.core import get_token_repository\nfrom accelbyte_py_sdk.services.auth.v2 import refresh_login\n\ntoken_repo = get_token_repository()\nrefresh_token = token_repo.get_refresh_token()\n\ntoken, error = refresh_login(refresh_token)\nassert error is None\n```\n\n\u003cdetails\u003e\n\u003csummary\u003ev1 (deprecated)\u003c/summary\u003e\n\n:bulb: Using `login_x(..., auto_refresh=True)` automatically refreshes the token once the expiration draws near.\n\n```python\n# set the refresh rate for 'login_client'\n# 0.8 means refresh when we 80% of the expiration duration has passed\nres, err = login_client(client_id, client_secret, auto_refresh=True, refresh_rate=0.8)\n```\n```python\n# set the refresh rate for 'login_user'\n# 0.8 means refresh when we 80% of the expiration duration has passed\nres, err = login_user(username, password, auto_refresh=True, refresh_rate=0.8)\n```\n\nThe auto refresh is only triggered when another request is fired. If you want to the refresh run automatically in the background. Use any of the `LoginXTimer` classes.\n\n```python\nfrom accelbyte_py_sdk.services.auth import LoginClientTimer, LoginPlatformTimer, LoginUserTimer, RefreshLoginTimer\n\nres, err = login_user(username, password)\nif err is not None:\n    exit(1)\n\n# creates a threading.Timer-like object that calls login_user every 1800 seconds repeatedly 'inf' times\ninterval = 1800\ntimer = LoginUserTimer(\n    interval,\n    username=username,\n    password=password,\n    repeats=-1,  # \u003c0: repeat 'inf' times | 0 or None: repeat 0 times | \u003e0: repeat n times \n    autostart=True,\n)\n```\n\nTo use on-demand token refresh, enable the `refresh_if_possible` option by setting it to True.\nThis configuration involves checking for the presence of an existing token, verifying its expiration status.\nIf the token has expired, the SDK will then examine whether a refresh token exists.\nIf a refresh token is available, it will be utilized to obtain a new token.\n\n```python\nres, error = login_user(username, password, refresh_if_possible=True)\n```\n\n\u003c/details\u003e\n\n## Using multiple SDK instances\n\nThe examples above demonstrates using just one instance of the Modular Python SDK (the default which is also global), but you could also instantiate multiple instances of the SDK and use them at the same time.\n\n```python\nimport accelbyte_py_sdk.services.auth.v2 as auth_service\nimport accelbyte_py_sdk.api.iam as iam_service\nimport accelbyte_py_sdk.api.iam.models as iam_models\n\nfrom accelbyte_py_sdk import AccelByteSDK\nfrom accelbyte_py_sdk.core import EnvironmentConfigRepository\nfrom accelbyte_py_sdk.core import InMemoryTokenRepository\n\n\n# Create 3 instances of the SDK\nclient_sdk = AccelByteSDK()\nuser_sdk1 = AccelByteSDK()\nuser_sdk2 = AccelByteSDK()\n\n\n# Initialize the SDKs\nclient_sdk.initialize(\n    options={\n        \"config\": EnvironmentConfigRepository(),\n        \"token\": InMemoryTokenRepository(),\n    }\n)\n\nuser_sdk1.initialize(\n    options={\n        \"config\": EnvironmentConfigRepository(),\n        \"token\": InMemoryTokenRepository(),\n    }\n)\n\nuser_sdk2.initialize(\n    options={\n        \"config\": user_sdk1.get_config_repository(),  # you could also share the config repo with User 1 SDK's\n        \"token\": InMemoryTokenRepository(),  # you could also do the same thing with token repos but that is not advisable. \n    }\n)\n\n\n# Login the SDKs\n_, error = auth_service.login_client(sdk=client_sdk)\n\nusername1, password1 = ...\n_, error = auth_service.login_user(username1, password1, sdk=user_sdk1)\n\nusername2, password2 = ...\n_, error = auth_service.login_user(username2, password2, sdk=user_sdk2)\n\n\n# Call an endpoint as User 1\nresult1, error = iam_service.public_create_user_v4(\n    body=iam_models.AccountCreateUserRequestV4.create_from_dict({...}),\n    sdk=user_sdk1,\n)\n\n# Call an endpoint as User 2\nresult2, error = iam_service.public_create_user_v4(\n    body=iam_models.AccountCreateUserRequestV4.create_from_dict({...}),\n    sdk=user_sdk2,\n)\n\n# Call an endpoint as the Admin IAM Client\nresult, error = admin_update_user_v4(\n    body=iam_models.ModelUserUpdateRequestV3.create_from_dict({...}),\n    user_id=result1.user_id,\n    sdk=client_sdk,\n)\n\n\n# Reset/Deintialize the SDKs after using\nclient_sdk1.deintialize()\nclient_sdk1.deintialize()\nclient_sdk1.deintialize()\n```\n\n### CLI\n\nYou can also use the Python Extend SDK to get tokens.\n\n```shell\npython -m accelbyte_py_sdk login -h\n```\n\n```text\nusage: python -m accelbyte_py_sdk login [-h] [-b BASE_URL] [-n NAMESPACE] [-c CLIENT_ID] [-s CLIENT_SECRET] [-u USERNAME] [-p PASSWORD] {client,user}\n\npositional arguments:\n  {client,user}\n\noptions:\n  -h, --help            show this help message and exit\n  -b BASE_URL, --base-url BASE_URL\n  -n NAMESPACE, --namespace NAMESPACE\n  -c CLIENT_ID, --client-id CLIENT_ID\n  -s CLIENT_SECRET, --client-secret CLIENT_SECRET\n  -u USERNAME, --username USERNAME\n  -p PASSWORD, --password PASSWORD\n```\n\n---\n\n```shell\npython -m accelbyte_py_sdk login client -b 'https://\u003cenvironment\u003e.accelbyte.io' -c **** -s ****  | jq -r .access_token\n```\n\n```text\neyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiQWNjZWwgSm9lIn0.VOnZ863KSLHhgJfupKzuKZq4ACcefUlcQwi1YvxdBlw\n```\n\n---\n\n```shell\nAB_BASE_URL='https://\u003cenvironment\u003e.accelbyte.io' AB_CLIENT_ID=**** AB_CLIENT_SECRET=**** python -m accelbyte_py_sdk login user -u **** -p ****  | jq -r .access_token\n```\n\n```text\neyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiQWNjZWwgSm9lIn0.VOnZ863KSLHhgJfupKzuKZq4ACcefUlcQwi1YvxdBlw\n```\n\n## Interacting with a Service Endpoint\n\n### Example A\n\nIn this example we will create a new user using the `POST` endpoint `/iam/v3/public/namespaces/{namespace}/users`\n\n```python\nimport json\n\nimport accelbyte_py_sdk\nfrom accelbyte_py_sdk.services.auth.v2 import login_client\n\n# Import the wrapper 'public_create_user_v3'\n# to know which wrapper to use open the docs/\u003cservice-name\u003e-index.md and\n# use the search function to find the wrapper name\nfrom accelbyte_py_sdk.api.iam import public_create_user_v3\n\n# This POST endpoint also requires a body of 'ModelUserCreateRequestV3'\n# so you will need to import that too, import it using this scheme:\n#  from accelbyte_py_sdk.api.\u003cservice-name\u003e.models import \u003cmodel-name\u003e\nfrom accelbyte_py_sdk.api.iam.models import ModelUserCreateRequestV3\nfrom accelbyte_py_sdk.api.iam.models import ModelUserCreateResponseV3\n\n\ndef main():\n    # 1 Initialize the SDK\n    accelbyte_py_sdk.initialize()\n\n    # 2 Login as a client (uses $AB_CLIENT_ID and $AB_CLIENT_SECRET)\n    _, error = login_client()\n\n    # 3 Create a user using the POST endpoint: /iam/v3/public/namespaces/{namespace}/users\n    #   * this endpoint requires:\n    #     - a 'body' (ModelUserCreateRequestV3)\n    #     - a 'namespace' (string)\n    #       'namespace' here is unique because it can be omitted, omitting it will result in\n    #       the SDK to automatically fill it out with the value of '$AB_NAMESPACE'\n    #   * more details on this endpoint can be found in:\n    #     accelbyte_py_sdk/api/iam/operations/users/public_create_user_v3.py\n    result, error = public_create_user_v3(\n        body=ModelUserCreateRequestV3.create(\n            auth_type=\"EMAILPASSWD\",\n            country=\"US\",\n            date_of_birth=\"2001-01-01\",\n            display_name=\"************\",\n            email_address=\"******@fakemail.com\",\n            password=\"******************\",\n        )\n    )\n\n    # 4 Check for errors\n    if error:\n      exit(1)\n\n    # 5 Do something with the result\n    print(json.dumps(result.to_dict(), indent=2))\n    # {\n    #   \"authType\": \"EMAILPASSWD\",\n    #   \"country\": \"US\",\n    #   \"dateOfBirth\": \"2001-01-01T00:00:00Z\",\n    #   \"displayName\": \"************\",\n    #   \"emailAddress\": \"******@fakemail.com\",\n    #   \"namespace\": \"******\",\n    #   \"userId\": \"********************************\"\n    # }\n\n\nif __name__ == \"__main__\":\n    main()\n\n```\n\n:bulb: All wrapper functions follow the return value format of `result, error`.\n\n:bulb: You could also write your own wrapper functions by using the models and operations in `accelbyte_py_sdk.api.\u003cservice-name\u003e` and `accelbyte_py_sdk.api.\u003cservice-name\u003e.models` respectively.\n\n:bulb: All wrapper functions have an asynchronous counterpart that ends with `_async`.\n\n### Example A (`async`)\n\nTo convert `Example A` asynchronously the following steps are needed.\n\n1. Import the asyncio package.\n\n    ```python\n    import asyncio\n    ```\n\n2. Convert the main method into `async`.\n\n    ```python\n    # def main():\n    async def main():\n    ```\n\n3. Change how the `main` function is invoked.\n\n    ```python\n    if __name__ == \"__main__\":\n        # main()\n        loop = asyncio.get_event_loop()\n        loop.run_until_complete(main())\n    ```\n\n4. Use `HttpxHttpClient`.\n\n    ```python\n    # accelbyte_py_sdk.initialize()\n    accelbyte_py_sdk.initialize(options={\"http\": \"HttpxHttpClient\"})\n    ```\n\n5. Use the `async` version of the wrapper by appending `_async`.\n\n    ```python\n    # from accelbyte_py_sdk.api.iam import public_create_user_v3\n    from accelbyte_py_sdk.api.iam import public_create_user_v3_async\n    ```\n\n6. Use the `async` wrapper with the `await` keyword.\n\n    ```python\n    # result, error = public_create_user_v3(\n    result, error = await public_create_user_v3_async(\n    ```\n\nHere is the full code:\n\n```python\nimport asyncio\nimport json\n\nimport accelbyte_py_sdk\nfrom accelbyte_py_sdk.services.auth.v2 import login_client\n\n# Import the wrapper 'public_create_user_v3_async'\n# to know which wrapper to use open the docs/\u003cservice-name\u003e-index.md and\n# use the search function to find the wrapper name\nfrom accelbyte_py_sdk.api.iam import public_create_user_v3_async\n\n# This POST endpoint also requires a body of 'ModelUserCreateRequestV3'\n# so you will need to import that too, import it using this scheme:\n#  from accelbyte_py_sdk.api.\u003cservice-name\u003e.models import \u003cmodel-name\u003e\nfrom accelbyte_py_sdk.api.iam.models import ModelUserCreateRequestV3\nfrom accelbyte_py_sdk.api.iam.models import ModelUserCreateResponseV3\n\n\nasync def main():\n    # 1 Initialize the SDK\n    accelbyte_py_sdk.initialize(options={\"http\": \"HttpxHttpClient\"})\n\n    # 2 Login as a client (uses $AB_CLIENT_ID and $AB_CLIENT_SECRET)\n    _, error = login_client()\n\n    # 3 Create a user using the POST endpoint: /iam/v3/public/namespaces/{namespace}/users\n    #   * this endpoint requires:\n    #     - a 'body' (ModelUserCreateRequestV3)\n    #     - a 'namespace' (string)\n    #       'namespace' here is unique because it can be omitted, omitting it will result in\n    #       the SDK to automatically fill it out with the value of '$AB_NAMESPACE'\n    #   * more details on this endpoint can be found in:\n    #     accelbyte_py_sdk/api/iam/operations/users/public_create_user_v3.py\n    result, error = await public_create_user_v3_async(\n        body=ModelUserCreateRequestV3.create(\n            auth_type=\"EMAILPASSWD\",\n            country=\"US\",\n            date_of_birth=\"2001-01-01\",\n            display_name=\"************\",\n            email_address=\"******@fakemail.com\",\n            password=\"******************\",\n        )\n    )\n\n    # 4 Check for errors\n    if error:\n      exit(1)\n\n    # 5 Do something with the result\n    print(json.dumps(result.to_dict(), indent=2))\n    # {\n    #   \"authType\": \"EMAILPASSWD\",\n    #   \"country\": \"US\",\n    #   \"dateOfBirth\": \"2001-01-01T00:00:00Z\",\n    #   \"displayName\": \"************\",\n    #   \"emailAddress\": \"******@fakemail.com\",\n    #   \"namespace\": \"******\",\n    #   \"userId\": \"********************************\"\n    # }\n\n\nif __name__ == \"__main__\":\n    loop = asyncio.get_event_loop()\n    loop.run_until_complete(main())\n\n```\n\n### Working with ApiResponse\n\n:bulb: As of the release of `ags/v3.80.0` all operations and their wrapper functions now return an instance of subclass [ApiResponse](src/core/accelbyte_py_sdk/core/_api_response.py) specific to the operation.\n\n```python\nfrom accelbyte_py_sdk.api.iam import public_create_user_v3\n\n\ndef main():\n    # The wrapper 'public_create_user_v3' wraps around\n    # the `PublicCreateUserV3` operation which returns\n    # an instance of `PublicCreateUserV3.Response` which is a\n    # subclass of `ApiResponse`.\n    # \n    # The class `PublicCreateUserV3.Response` also implements the\n    # '__iter__' dunder method that allows it to be unpacked into\n    # `result, error` maintaining the previous syntax.\n    # \n    # class PublicCreateUserV3(Operation):\n    #     class Response(ApiResponse):\n    #         def __iter__(self):\n    #             yield data\n    #             yield error\n    response = public_create_user_v3(...)\n    result, error = response\n    if error:\n       exit(1)\n \n\nif __name__ == \"__main__\":\n    main()\n\n```\n\n:bulb: You can also use the `ok()` method in the `ApiResponse` object to raise an `Exception` if the response is not successful.\n\n```python\nfrom accelbyte_py_sdk.api.iam import public_create_user_v3\n\n\ndef main():\n    response = public_create_user_v3(...).ok()\n    # or\n    # result, error = public_create_user_v3(...).ok()\n\nif __name__ == \"__main__\":\n    main()\n\n```\n\n:bulb: You can also compare the error from the `ApiResponse` object against known errors in the service.\n\n```python\nfrom accelbyte_py_sdk.api.iam import public_create_user_v3\nfrom accelbyte_py_sdk.api.iam.errors import ERROR_10153, ERROR_10154  # known errors for the IAM service\n\n\ndef main():\n    response = public_create_user_v3(...)\n    if response.error:\n        # get error code\n        error_code = response.error.code\n        \n        # get error message\n        error_message = response.error.message\n       \n        # handle errors depending on the code\n        # - ERROR_10153 = ApiError(code=\"10153\", message=\"user exist\")\n        # - ERROR_10154 = ApiError(code=\"10154\", message=\"country not found\")\n        if response.error.code == ERROR_10153.code:\n            do_something()\n        elif response.error.code == ERROR_10154.code:\n            do_something_else()\n            \n         # raise an exception\n        raise response.error.to_exception()\n\n\nif __name__ == \"__main__\":\n    main()\n\n```\n\n---\n\n## Configuring HTTP Retry\n\nTo use the `HTTP Retry` feature, set the `HttpClient`'s `retry_policy` and `backoff_policy`.\n\n```python\nimport accelbyte_py_sdk\nfrom accelbyte_py_sdk.core import get_http_client\n\n# 1 Initialize the SDK\naccelbyte_py_sdk.initialize()\n\n# 2 Get the HTTP Client\nhttp_client = get_http_client()\n\n# 3 Configure the `retry_policy` and `backoff_policy`\n\n# 3a. Retry 3 times with 0.5 seconds delay in between\nfrom accelbyte_py_sdk.core import ConstantHttpBackoffPolicy\nfrom accelbyte_py_sdk.core import MaxRetriesHttpRetryPolicy\n\nhttp_client.retry_policy = MaxRetriesHttpRetryPolicy(3)\n\n# 3b. Retry when total elapsed time is less than 15 seconds, with an exponential backoff duration.\nfrom accelbyte_py_sdk.core import ExponentialHttpBackoffPolicy\nfrom accelbyte_py_sdk.core import MaxElapsedHttpRetryPolicy\n\nhttp_client.backoff_policy = ExponentialHttpBackoffPolicy(initial=1.0, multiplier=2.0)\nhttp_client.retry_policy = MaxElapsedHttpRetryPolicy(15)\n\n# 3c. Use custom retry and backoff policies.\nfrom datetime import timedelta\nfrom typing import Optional\n\ndef my_custom_retry_policy(request, response, /, *, retries: int = 0, elapsed: Optional[timedelta] = None, **kwargs) -\u003e float:\n    return \"Retry-After\" in response.headers and retries == 1  # Retry if the 'Retry-After' header exists and we are on the 1st retry (2nd attempt).\n\ndef my_custom_backoff_policy(request, response, /, *, retries: int = 0, elapsed: Optional[timedelta] = None, **kwargs) -\u003e float:\n    return response.headers.get(\"Retry-After\", 1)  # Use the value of the 'Retry-After' response header, default to 1.0s.\n\nhttp_client.backoff_policy = my_custom_backoff_policy\nhttp_client.retry_policy = my_custom_retry_policy\n\n# 3d. Combining multiple retry policies.\nfrom accelbyte_py_sdk.core import CompositeHttpRetryPolicy\nfrom accelbyte_py_sdk.core import MaxRetriesHttpRetryPolicy\nfrom accelbyte_py_sdk.core import StatusCodesHttpRetryPolicy\n\nhttp_client.retry_policy = CompositeHttpRetryPolicy(\n    StatusCodesHttpRetryPolicy(401, (501, 503)),  # Retry when response status code is 401, 501 to 503 (501, 502, or 503) -- AND\n    MaxRetriesHttpRetryPolicy(3)                  #       when number of retries is less than or equal to 3.\n)\n```\n\n---\n\n## Validating Tokens\n\nYou can use `accelbyte_py_sdk.token_validation.caching.CachingTokenValidator` or `accelbyte_py_sdk.token_validation.iam.IAMTokenValidator`.\n\n```python\ntoken_validator = CachingTokenValidator(sdk)  # or IAMTokenValidator(sdk)\n\n# access_token = ...\nerror = token_validator.validate_token(access_token)\nif error:\n    raise error\n```\n\n---\n\nSee [tests](tests/sdk/core/_request.py) for more usage.\n\n## Samples\n\nSample apps are available in the [samples](samples) directory\n\n## Documentation\n\nFor documentation about AccelByte services and SDK, see [docs.accelbyte.io](https://docs.accelbyte.io/)\n\n:bulb: Check out the index files in the [docs](docs) directory if you are looking for a specific endpoint.\n\n---\n\n## Misc\n\n### Utility Functions\n\nCheck if the SDK is initialized.\n\n```python\nimport accelbyte_py_sdk\n\n\nis_initialized = accelbyte_py_sdk.is_initialized()\n\nprint(is_initialized)\n# False\n```\n\nCreate a Basic Auth from a string tuple.\n\n```python\nimport accelbyte_py_sdk\n\n\nbasic_auth = accelbyte_py_sdk.core.create_basic_authentication(\"foo\", \"bar\")\n\nprint(basic_auth)\n# Basic Zm9vOmJhcg==\n```\n\nGets the stored access token.\n\n```python\nimport accelbyte_py_sdk\n\n\naccess_token, error = accelbyte_py_sdk.core.get_access_token()\n\nprint(access_token)\n# ************************************\n```\n\nGet `AB_*` environment configuration values.\n\n```python\nimport accelbyte_py_sdk\n\n\nbase_url, client_id, client_secret, namespace = accelbyte_py_sdk.core.get_env_config()\n\nprint(f\"{base_url}, {client_id}, {client_secret}, {namespace}\")\n# \u003c$AB_BASE_URL\u003e, \u003c$AB_CLIENT_ID\u003e, \u003c$AB_CLIENT_SECRET\u003e, \u003c$AB_NAMESPACE\u003e\n```\n\nGet `AB_*` environment user credential values.\n\n```python\nimport accelbyte_py_sdk\n\n\nusername, password = accelbyte_py_sdk.core.get_env_user_credentials()\n\nprint(f\"{base_url}: {client_id}\")\n# \u003c$AB_USERNAME\u003e: \u003c$AB_PASSWORD\u003e\n```\n\nSet logger level and add logger handlers.\n\n```python\nimport logging\n\n# 1. The SDK has helper functions for logging.\n\naccelbyte_py_sdk.core.set_logger_level(logging.INFO)          # 'accelbyte_py_sdk'\naccelbyte_py_sdk.core.set_logger_level(logging.INFO, \"http\")  # 'accelbyte_py_sdk.http'\naccelbyte_py_sdk.core.set_logger_level(logging.INFO, \"ws\")    # 'accelbyte_py_sdk.ws'\n\n\n# 2. You could also use this helper function for debugging.\n\naccelbyte_py_sdk.core.add_stream_handler_to_logger()          # sends content of the 'accelbyte_py_sdk' logger to 'sys.stderr'.\n\n\n# 3. There is a helper function that helps you get started with log files.\n\naccelbyte_py_sdk.core.add_buffered_file_handler_to_logger(    # flushes content of the 'accelbyte_py_sdk' logger to a file named 'sdk.log' every 10 logs.\n    filename=\"/path/to/sdk.log\",\n    capacity=10,\n    level=logging.INFO\n)\naccelbyte_py_sdk.core.add_buffered_file_handler_to_logger(    # flushes content of the 'accelbyte_py_sdk.http' logger to a file named 'http.log' every 3 logs.\n    filename=\"/path/to/http.log\",\n    capacity=3,\n    level=logging.INFO,\n    additional_scope=\"http\"\n)\n\n# 3.a. Or you could the same thing when initializing the SDK.\n\naccelbyte_py_sdk.initialize(\n    options={\n        \"log_files\": {\n            \"\": \"/path/to/sdk.log\",                           # flushes content of the 'accelbyte_py_sdk' logger to a file named 'sdk.log' every 10 logs.\n            \"http\": {                                         # flushes content of the 'accelbyte_py_sdk.http' logger to a file named 'http.log' every 3 logs.\n                \"filename\": \"/path/to/http.log\",\n                \"capacity\": 3,\n                \"level\": logging.INFO\n            }\n        }\n    }\n)\n\n# 4. By default logs from 'accelbyte_py_sdk.http' are stringified dictionaries, you can set your own formatter like so.\n\ndef format_request_response_as_yaml(data: dict) -\u003e str:\n    return f\"---\\n{yaml.safe_dump(data, sort_keys=False).rstrip()}\\n...\"\n\nhttp_client = accelbyte_py_sdk.core.get_http_client()\nhttp_client.request_log_formatter = format_request_response_as_yaml\nhttp_client.response_log_formatter = format_request_response_as_yaml\n```\n\n---\n\n## In-depth Topics\n\n### Generated code\n\n#### Models\n\nEach definition in `#/definitions/` is turned into a Model.\n\nExample:\n\n```yaml\n# UserProfileInfo\nproperties:\n  avatarLargeUrl:\n    type: string\n  avatarSmallUrl:\n    type: string\n  avatarUrl:\n    type: string\n  customAttributes:\n    additionalProperties:\n      type: object\n    type: object\n  dateOfBirth:\n    format: date\n    type: string\n    x-nullable: true\n  firstName:\n    type: string\n  language:\n    type: string\n  lastName:\n    type: string\n  namespace:\n    type: string\n  status:\n    enum:\n    - ACTIVE\n    - INACTIVE\n    type: string\n  timeZone:\n    type: string\n  userId:\n    type: string\n  zipCode:\n    type: string\ntype: object\n\n```\n\n```python\n# accelbyte_py_sdk/api/basic/models/user_profile_info.py\n\nclass UserProfileInfo(Model):\n    \"\"\"User profile info (UserProfileInfo)\n\n    Properties:\n        avatar_large_url: (avatarLargeUrl) OPTIONAL str\n\n        avatar_small_url: (avatarSmallUrl) OPTIONAL str\n\n        avatar_url: (avatarUrl) OPTIONAL str\n\n        custom_attributes: (customAttributes) OPTIONAL Dict[str, Any]\n\n        date_of_birth: (dateOfBirth) OPTIONAL str\n\n        first_name: (firstName) OPTIONAL str\n\n        language: (language) OPTIONAL str\n\n        last_name: (lastName) OPTIONAL str\n\n        namespace: (namespace) OPTIONAL str\n\n        status: (status) OPTIONAL Union[str, StatusEnum]\n\n        time_zone: (timeZone) OPTIONAL str\n\n        user_id: (userId) OPTIONAL str\n\n        zip_code: (zipCode) OPTIONAL str\n    \"\"\"\n\n    # region fields\n\n    avatar_large_url: str                                                                          # OPTIONAL\n    avatar_small_url: str                                                                          # OPTIONAL\n    avatar_url: str                                                                                # OPTIONAL\n    custom_attributes: Dict[str, Any]                                                              # OPTIONAL\n    date_of_birth: str                                                                             # OPTIONAL\n    first_name: str                                                                                # OPTIONAL\n    language: str                                                                                  # OPTIONAL\n    last_name: str                                                                                 # OPTIONAL\n    namespace: str                                                                                 # OPTIONAL\n    status: Union[str, StatusEnum]                                                                 # OPTIONAL\n    time_zone: str                                                                                 # OPTIONAL\n    user_id: str                                                                                   # OPTIONAL\n    zip_code: str                                                                                  # OPTIONAL\n\n    # endregion fields\n```\n\nthere are also a number of utility functions generated with each model that should help in the ease of use.\n\n```python\n# accelbyte_py_sdk/api/basic/models/user_profile_info.py\n\n    ...\n\n    def with_user_id(self, value: str) -\u003e UserProfileInfo:\n        self.user_id = value\n        return self\n\n    # other with_x() methods too\n\n    def to_dict(self, include_empty: bool = False) -\u003e dict:\n        result: dict = {}\n        ...\n        return result\n\n    @classmethod\n    def create(\n        cls,\n        avatar_large_url: Optional[str] = None,\n        avatar_small_url: Optional[str] = None,\n        avatar_url: Optional[str] = None,\n        custom_attributes: Optional[Dict[str, Any]] = None,\n        date_of_birth: Optional[str] = None,\n        first_name: Optional[str] = None,\n        language: Optional[str] = None,\n        last_name: Optional[str] = None,\n        namespace: Optional[str] = None,\n        status: Optional[Union[str, StatusEnum]] = None,\n        time_zone: Optional[str] = None,\n        user_id: Optional[str] = None,\n        zip_code: Optional[str] = None,\n    ) -\u003e UserProfileInfo:\n        instance = cls()\n        ...\n        return instance\n\n    @classmethod\n    def create_from_dict(cls, dict_: dict, include_empty: bool = False) -\u003e UserProfileInfo:\n        instance = cls()\n        ...\n        return instance\n\n    @staticmethod\n    def get_field_info() -\u003e Dict[str, str]:\n        return {\n            \"avatarLargeUrl\": \"avatar_large_url\",\n            \"avatarSmallUrl\": \"avatar_small_url\",\n            \"avatarUrl\": \"avatar_url\",\n            \"customAttributes\": \"custom_attributes\",\n            \"dateOfBirth\": \"date_of_birth\",\n            \"firstName\": \"first_name\",\n            \"language\": \"language\",\n            \"lastName\": \"last_name\",\n            \"namespace\": \"namespace\",\n            \"status\": \"status\",\n            \"timeZone\": \"time_zone\",\n            \"userId\": \"user_id\",\n            \"zipCode\": \"zip_code\",\n        }\n\n    ...\n```\n\n#### Operations\n\nEach path item in `#/paths` is turned into an Operation.\n\nExample:\n\n```yaml\n# GET /basic/v1/public/namespaces/{namespace}/users/{userId}/profiles\ndescription: 'Get user profile.\u0026lt;br\u0026gt;Other detail info: \u0026lt;ul\u0026gt;\u0026lt;li\u0026gt;\u0026lt;i\u0026gt;Required\n  permission\u0026lt;/i\u0026gt;: resource=\u0026lt;b\u0026gt;\u0026#34;NAMESPACE:{namespace}:USER:{userId}:PROFILE\u0026#34;\u0026lt;/b\u0026gt;,\n  action=2 \u0026lt;b\u0026gt;(READ)\u0026lt;/b\u0026gt;\u0026lt;/li\u0026gt;\u0026lt;li\u0026gt;\u0026lt;i\u0026gt;Action code\u0026lt;/i\u0026gt;:\n  11403\u0026lt;/li\u0026gt;\u0026lt;li\u0026gt;\u0026lt;i\u0026gt;Returns\u0026lt;/i\u0026gt;: user profile\u0026lt;/li\u0026gt;\u0026lt;/ul\u0026gt;'\noperationId: publicGetUserProfileInfo\nparameters:\n- description: namespace, only accept alphabet and numeric\n  in: path\n  name: namespace\n  required: true\n  type: string\n- description: user's id, should follow UUID version 4 without hyphen\n  in: path\n  name: userId\n  required: true\n  type: string\nproduces:\n- application/json\nresponses:\n  '200':\n    description: Successful operation\n    schema:\n      $ref: '#/definitions/UserProfileInfo'\n  '400':\n    description: \u003ctable\u003e\u003ctr\u003e\u003ctd\u003eerrorCode\u003c/td\u003e\u003ctd\u003eerrorMessage\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e20002\u003c/td\u003e\u003ctd\u003evalidation\n      error\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n    schema:\n      $ref: '#/definitions/ValidationErrorEntity'\n  '401':\n    description: \u003ctable\u003e\u003ctr\u003e\u003ctd\u003eerrorCode\u003c/td\u003e\u003ctd\u003eerrorMessage\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e20001\u003c/td\u003e\u003ctd\u003eunauthorized\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n    schema:\n      $ref: '#/definitions/ErrorEntity'\n  '403':\n    description: \u003ctable\u003e\u003ctr\u003e\u003ctd\u003eerrorCode\u003c/td\u003e\u003ctd\u003eerrorMessage\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e20013\u003c/td\u003e\u003ctd\u003einsufficient\n      permission\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n    schema:\n      $ref: '#/definitions/ErrorEntity'\n  '404':\n    description: '\u003ctable\u003e\u003ctr\u003e\u003ctd\u003eerrorCode\u003c/td\u003e\u003ctd\u003eerrorMessage\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e11440\u003c/td\u003e\u003ctd\u003eUnable\n      to {action}: User profile not found in namespace [{namespace}]\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e'\n    schema:\n      $ref: '#/definitions/ErrorEntity'\nsecurity:\n- authorization: []\n- HasPermission:\n  - NAMESPACE:{namespace}:USER:{userId}:PROFILE [READ]\n  authorization: []\nsummary: Get user profile\ntags:\n- UserProfile\nx-authorization:\n  action: '2'\n  resource: NAMESPACE:{namespace}:USER:{userId}:PROFILE\n\n```\n\nsame with the models there are also a number of utility functions generated with each operation that should help in the ease of use.\n\n```python\n# Copyright (c) 2021 AccelByte Inc. All Rights Reserved.\n# This is licensed software from AccelByte Inc, for limitations\n# and restrictions contact your company contract manager.\n# \n# Code generated. DO NOT EDIT!\n\n# template file: operation.j2\n\n# pylint: disable=duplicate-code\n# pylint: disable=line-too-long\n# pylint: disable=missing-function-docstring\n# pylint: disable=missing-module-docstring\n# pylint: disable=too-many-arguments\n# pylint: disable=too-many-branches\n# pylint: disable=too-many-instance-attributes\n# pylint: disable=too-many-lines\n# pylint: disable=too-many-locals\n# pylint: disable=too-many-public-methods\n# pylint: disable=too-many-return-statements\n# pylint: disable=too-many-statements\n# pylint: disable=unused-import\n\n# AccelByte Gaming Services Basic Service (2.13.1)\n\nfrom __future__ import annotations\nfrom typing import Any, Dict, List, Optional, Tuple, Union\n\nfrom accelbyte_py_sdk.core import Operation\nfrom accelbyte_py_sdk.core import HeaderStr\nfrom accelbyte_py_sdk.core import HttpResponse\n\nfrom ...models import ErrorEntity\nfrom ...models import UserProfileInfo\nfrom ...models import ValidationErrorEntity\n\n\nclass PublicGetUserProfileInfo(Operation):\n    \"\"\"Get user profile (publicGetUserProfileInfo)\n\n    Get user profile.\n    Other detail info:\n\n      * Required permission : resource= \"NAMESPACE:{namespace}:USER:{userId}:PROFILE\" , action=2 (READ)\n      *  Action code : 11403\n      *  Returns : user profile\n\n    Required Permission(s):\n        - NAMESPACE:{namespace}:USER:{userId}:PROFILE [READ]\n\n    Properties:\n        url: /basic/v1/public/namespaces/{namespace}/users/{userId}/profiles\n\n        method: GET\n\n        tags: [\"UserProfile\"]\n\n        consumes: []\n\n        produces: [\"application/json\"]\n\n        securities: [BEARER_AUTH] or [BEARER_AUTH]\n\n        namespace: (namespace) REQUIRED str in path\n\n        user_id: (userId) REQUIRED str in path\n\n    Responses:\n        200: OK - UserProfileInfo (Successful operation)\n\n        400: Bad Request - ValidationErrorEntity (20002: validation error)\n\n        401: Unauthorized - ErrorEntity (20001: unauthorized)\n\n        403: Forbidden - ErrorEntity (20013: insufficient permission)\n\n        404: Not Found - ErrorEntity (11440: Unable to {action}: User profile not found in namespace [{namespace}])\n    \"\"\"\n\n    # region fields\n\n    _url: str = \"/basic/v1/public/namespaces/{namespace}/users/{userId}/profiles\"\n    _method: str = \"GET\"\n    _consumes: List[str] = []\n    _produces: List[str] = [\"application/json\"]\n    _securities: List[List[str]] = [[\"BEARER_AUTH\"], [\"BEARER_AUTH\"]]\n    _location_query: str = None\n\n    namespace: str                                                                                 # REQUIRED in [path]\n    user_id: str                                                                                   # REQUIRED in [path]\n\n    # endregion fields\n\n    # region properties\n\n    @property\n    def url(self) -\u003e str:\n        return self._url\n\n    @property\n    def method(self) -\u003e str:\n        return self._method\n\n    @property\n    def consumes(self) -\u003e List[str]:\n        return self._consumes\n\n    @property\n    def produces(self) -\u003e List[str]:\n        return self._produces\n\n    @property\n    def securities(self) -\u003e List[List[str]]:\n        return self._securities\n\n    @property\n    def location_query(self) -\u003e str:\n        return self._location_query\n\n    # endregion properties\n\n    # region get methods\n\n    # endregion get methods\n\n    # region get_x_params methods\n\n    def get_all_params(self) -\u003e dict:\n        return {\n            \"path\": self.get_path_params(),\n        }\n\n    def get_path_params(self) -\u003e dict:\n        result = {}\n        if hasattr(self, \"namespace\"):\n            result[\"namespace\"] = self.namespace\n        if hasattr(self, \"user_id\"):\n            result[\"userId\"] = self.user_id\n        return result\n\n    # endregion get_x_params methods\n\n    # region is/has methods\n\n    # endregion is/has methods\n\n    # region with_x methods\n\n    def with_namespace(self, value: str) -\u003e PublicGetUserProfileInfo:\n        self.namespace = value\n        return self\n\n    def with_user_id(self, value: str) -\u003e PublicGetUserProfileInfo:\n        self.user_id = value\n        return self\n\n    # endregion with_x methods\n\n    # region to methods\n\n    def to_dict(self, include_empty: bool = False) -\u003e dict:\n        result: dict = {}\n        if hasattr(self, \"namespace\") and self.namespace:\n            result[\"namespace\"] = str(self.namespace)\n        elif include_empty:\n            result[\"namespace\"] = \"\"\n        if hasattr(self, \"user_id\") and self.user_id:\n            result[\"userId\"] = str(self.user_id)\n        elif include_empty:\n            result[\"userId\"] = \"\"\n        return result\n\n    # endregion to methods\n\n    # region response methods\n\n    # noinspection PyMethodMayBeStatic\n    def parse_response(\n        self, code: int, content_type: str, content: Any\n    ) -\u003e Tuple[\n        Union[None, UserProfileInfo],\n        Union[None, ErrorEntity, HttpResponse, ValidationErrorEntity],\n    ]:\n        \"\"\"Parse the given response.\n\n        200: OK - UserProfileInfo (Successful operation)\n\n        400: Bad Request - ValidationErrorEntity (20002: validation error)\n\n        401: Unauthorized - ErrorEntity (20001: unauthorized)\n\n        403: Forbidden - ErrorEntity (20013: insufficient permission)\n\n        404: Not Found - ErrorEntity (11440: Unable to {action}: User profile not found in namespace [{namespace}])\n\n        ---: HttpResponse (Undocumented Response)\n\n        ---: HttpResponse (Unexpected Content-Type Error)\n\n        ---: HttpResponse (Unhandled Error)\n        \"\"\"\n        pre_processed_response, error = self.pre_process_response(\n            code=code, content_type=content_type, content=content\n        )\n        if error is not None:\n            return None, None if error.is_no_content() else error\n        code, content_type, content = pre_processed_response\n\n        if code == 200:\n            return UserProfileInfo.create_from_dict(content), None\n        if code == 400:\n            return None, ValidationErrorEntity.create_from_dict(content)\n        if code == 401:\n            return None, ErrorEntity.create_from_dict(content)\n        if code == 403:\n            return None, ErrorEntity.create_from_dict(content)\n        if code == 404:\n            return None, ErrorEntity.create_from_dict(content)\n\n        return self.handle_undocumented_response(\n            code=code, content_type=content_type, content=content\n        )\n\n    # endregion response methods\n\n    # region static methods\n\n    @classmethod\n    def create(cls, namespace: str, user_id: str, **kwargs) -\u003e PublicGetUserProfileInfo:\n        instance = cls()\n        instance.namespace = namespace\n        instance.user_id = user_id\n        return instance\n\n    @classmethod\n    def create_from_dict(\n        cls, dict_: dict, include_empty: bool = False\n    ) -\u003e PublicGetUserProfileInfo:\n        instance = cls()\n        if \"namespace\" in dict_ and dict_[\"namespace\"] is not None:\n            instance.namespace = str(dict_[\"namespace\"])\n        elif include_empty:\n            instance.namespace = \"\"\n        if \"userId\" in dict_ and dict_[\"userId\"] is not None:\n            instance.user_id = str(dict_[\"userId\"])\n        elif include_empty:\n            instance.user_id = \"\"\n        return instance\n\n    @staticmethod\n    def get_field_info() -\u003e Dict[str, str]:\n        return {\n            \"namespace\": \"namespace\",\n            \"userId\": \"user_id\",\n        }\n\n    @staticmethod\n    def get_required_map() -\u003e Dict[str, bool]:\n        return {\n            \"namespace\": True,\n            \"userId\": True,\n        }\n\n    # endregion static methods\n\n```\n\n#### Creating\n\n:bulb: there are 4 ways to create an instance of these models and operations.\n\n```python\n# 1. using the python __init__() function then setting the parameters manually:\nmodel = ModelName()\nmodel.param_a = \"foo\"\nmodel.param_b = \"bar\"\n\n# 2. using the python __init__() function together with the 'with_x' methods:\n# # the 'with_x' functions are type annotated and will show warnings if a wrong type is passed.\nmodel = ModelName() \\\n    .with_param_a(\"foo\") \\\n    .with_param_b(\"bar\")\n\n# 3. using the ModelName.create(..) class method:\n# # parameters here are also type annotated and will throw a TypeError if a required field was not filled out.\nmodel = ModelName.create(\n    param_a=\"foo\",\n    param_b=\"bar\",\n)\n\n# 4. using the ModelName.create_from_dict(..) class method:\n# # this method also has a 'include_empty' option that would get ignore values that evaluate to False, None, or len() == 0.\nmodel_params = {\n    \"param_a\": \"foo\",\n    \"param_b\": \"bar\",\n    \"param_c\": False,\n    \"param_d\": None,\n    \"param_e\": [],\n    \"param_f\": {},\n}\nmodel = ModelName.create_from_dict(model_params)\n\n# all of these apply to all operations too.\n```\n\n#### Wrappers\n\nTo improve ergonomics the code generator also generates wrappers around the operations.\nThe purpose of these wrappers is to automatically fill up parameters that the SDK already knows.\n(e.g. namespace, client_id, access_token, etc.)\n\nThey are located at `accelbyte_py_sdk.api.\u003cservice-name\u003e.wrappers` but can be accessed like so: `from accelbyte_py_sdk.api.\u003cservice-name\u003e import \u003cwrapper-name\u003e`\n\n```python\nimport accelbyte_py_sdk\nfrom accelbyte_py_sdk.api.iam import token_grant_v3\n\nif __name__ == \"__main__\":\n    accelbyte_py_sdk.initialize()\n\n    token, error = token_grant_v3(\n        grant_type=\"client_credentials\"\n    )\n    assert error is not None\n```\n\nThe wrapper function `token_grant_v3` is a wrapper for the `TokenGrantV3` operation.\nIt automatically passes in the information needed like the Basic Auth Headers.\nThe values are gotten from the current `ConfigRepository`.\n\ncontinuing from the previous examples (GetUserProfileInfo), its wrapper would be:\n\n```python\n# accelbyte_py_sdk/api/basic/wrappers/_user_profile.py\n\nfrom typing import Any, Dict, List, Optional, Tuple, Union\n\nfrom accelbyte_py_sdk.core import get_namespace as get_services_namespace\nfrom accelbyte_py_sdk.core import run_request\nfrom accelbyte_py_sdk.core import same_doc_as\n\nfrom ..operations.user_profile import PublicGetUserProfileInfo\n\n\n@same_doc_as(PublicGetUserProfileInfo)\ndef public_get_user_profile_info(\n    user_id: str,\n    namespace: Optional[str] = None,\n    x_additional_headers: Optional[Dict[str, str]] = None,\n    **kwargs\n):\n    if namespace is None:\n        namespace, error = get_services_namespace()\n        if error:\n            return None, error\n    request = PublicGetUserProfileInfo.create(\n        user_id=user_id,\n        namespace=namespace,\n    )\n    return run_request(request, additional_headers=x_additional_headers, **kwargs)\n```\n\nthis wrapper function automatically fills up the required path parameter `namespace`.\n\nnow to use it only the `user_id` is now required.\n\n```python\nimport accelbyte_py_sdk\nfrom accelbyte_py_sdk.api.basic import public_get_user_profile_info\n\nif __name__ == \"__main__\":\n    accelbyte_py_sdk.initialize()\n\n    user_profile_info, error = public_get_user_profile_info(user_id=\"lorem\")\n    assert error is not None\n\n    print(f\"Hello there {user_profile_info.first_name}!\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccelbyte%2Faccelbyte-python-modular-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faccelbyte%2Faccelbyte-python-modular-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccelbyte%2Faccelbyte-python-modular-sdk/lists"}