multigp_toolkit.multigpapi
==========================

.. py:module:: multigp_toolkit.multigpapi

.. autoapi-nested-parse::

   MultiGP RaceSync API Access



Attributes
----------

.. autoapisummary::

   multigp_toolkit.multigpapi.logger
   multigp_toolkit.multigpapi.T
   multigp_toolkit.multigpapi.U
   multigp_toolkit.multigpapi.BASE_API_URL


Classes
-------

.. autoapisummary::

   multigp_toolkit.multigpapi.MultiGPAPI


Module Contents
---------------

.. py:data:: logger

   Module logger


.. py:data:: T

   Generic for typing


.. py:data:: U

   Generic for typing


.. py:data:: BASE_API_URL
   :value: 'https://www.multigp.com/mgp/multigpwebservice'


   MultiGP API base URL


.. py:class:: MultiGPAPI(rhapi)

   Bases: :py:obj:`multigp_toolkit.abstracts._APIManager`


   The primary class used to interact with the MultiGP RaceSync API

   .. seealso::

       https://www.multigp.com/apidocumentation/


   .. py:attribute:: _api_key
      :type:  Union[str, None]
      :value: None


      Chapter API key



   .. py:attribute:: _chapter_id
      :type:  Union[int, None]
      :value: None


      MultiGP id for the chapter



   .. py:method:: _request_and_parse(request_type, url, json_request)

      Request data from the MultiGP API and parse it's output

      :param request_type: The request type
      :param url: The url to send the request
      :param json_request: The payload
      :return: The parsed data



   .. py:method:: set_api_key(api_key)

      Sets the MultiGP api key for

      :param apiKey: The MultiGP api key for the chapter



   .. py:method:: pull_chapter()

      Find the chapter for the set RaceSync API key.

      :return: The name of the Chapter, returns None if chapter not found



   .. py:method:: pull_races()

      Pull the avaliable races for the chapter.

      :return: Keypair of the race id and the race name. Returns
      None if race not found.



   .. py:method:: pull_race_data(race_id)

      retrieve the race data for a specific race.

      :param race_id: The MultiGP id for the race.
      :return: _description_



   .. py:method:: pull_additional_rounds(race_id, round_num)

      Downloads round informtions. Typcially used for ZippyQ.

      :param race_id: ID of the t
      :param round_num: Round number to pull
      :return: The race data for the round



   .. py:method:: push_slot_and_score(captured_data)

      Push individual results to the RaceSync API

      :param captured_data: Data to send to RaceSync. Elements of the tuple include
      (race_id, round_number, heat_number, slot_number, race_data).
      :return: The status of the results push



   .. py:method:: push_overall_race_results(race_id, bracket_results)

      Push the overall results to the RaceSync API

      :param race_id: The race id
      :param bracket_results: A list of pilot rankings
      :return: The status of the reuslts push



