text: # Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
  # This is licensed software from AccelByte Inc, for limitations
  # and restrictions contact your company contract manager.
  #
  # Code generated. DO NOT EDIT!
  
  # template_file: python-cli-command.j2
  
  # justice-platform-service (4.10.0)
  
  # pylint: disable=duplicate-code
  # pylint: disable=line-too-long
  # pylint: disable=missing-function-docstring
  # pylint: disable=missing-module-docstring
  # pylint: disable=too-many-arguments
  # pylint: disable=too-many-branches
  # pylint: disable=too-many-instance-attributes
  # pylint: disable=too-many-lines
  # pylint: disable=too-many-locals
  # pylint: disable=too-many-public-methods
  # pylint: disable=too-many-return-statements
  # pylint: disable=too-many-statements
  # pylint: disable=unused-import
  
  import json
  import yaml
  from typing import Optional
  
  import click
  
  from .._utils import login_as as login_as_internal
  from .._utils import to_dict
  from accelbyte_py_sdk.api.platform import fulfill_user_order as fulfill_user_order_internal
  from accelbyte_py_sdk.api.platform.models import ErrorEntity
  from accelbyte_py_sdk.api.platform.models import OrderInfo
  
  
  @click.command()
  @click.argument("order_no", type=str)
  @click.argument("user_id", type=str)
  @click.option("--namespace", type=str)
  @click.option("--login_as", type=click.Choice(["client", "user"], case_sensitive=False))
  @click.option("--login_with_auth", type=str)
  @click.option("--doc", type=bool)
  def fulfill_user_order(
          order_no: str,
          user_id: str,
          namespace: Optional[str] = None,
          login_as: Optional[str] = None,
          login_with_auth: Optional[str] = None,
          doc: Optional[bool] = None,
  ):
      if doc:
          click.echo(fulfill_user_order_internal.__doc__)
          return
      x_additional_headers = None
      if login_with_auth:
          x_additional_headers = {
              "Authorization": login_with_auth
          }
      else:
          login_as_internal(login_as)
      result, error = fulfill_user_order_internal(
          order_no=order_no,
          user_id=user_id,
          namespace=namespace,
          x_additional_headers=x_additional_headers,
      )
      if error:
          raise Exception(f"fulfillUserOrder failed: {str(error)}")
      click.echo(yaml.safe_dump(to_dict(result), sort_keys=False))
  
  
  fulfill_user_order.operation_id = "fulfillUserOrder"
  fulfill_user_order.is_deprecated = False
  