text: # coding: utf-8
  
  """
      PTV Timetable API - Version 3
  
      The PTV Timetable API provides direct access to Public Transport Victoria’s public transport timetable data.    The API returns scheduled timetable, route and stop data for all metropolitan and regional train, tram and bus services in Victoria, including Night Network(Night Train and Night Tram data are included in metropolitan train and tram services data, respectively, whereas Night Bus is a separate route type).    The API also returns real-time data for metropolitan train, tram and bus services (where this data is made available to PTV), as well as disruption information, stop facility information, and access to myki ticket outlet data.    This Swagger is for Version 3 of the PTV Timetable API. By using this documentation you agree to comply with the licence and terms of service.    Train timetable data is updated daily, while the remaining data is updated weekly, taking into account any planned timetable changes (for example, due to holidays or planned disruptions). The PTV timetable API is the same API used by PTV for its apps. To access the most up to date data PTV has (including real-time data) you must use the API dynamically.    You can access the PTV Timetable API through a HTTP or HTTPS interface, as follows:        base URL / version number / API name / query string  The base URL is either:    *  http://timetableapi.ptv.vic.gov.au  or    *  https://timetableapi.ptv.vic.gov.au    The Swagger JSON file is available at http://timetableapi.ptv.vic.gov.au/swagger/docs/v3    Frequently asked questions are available on the PTV website at http://ptv.vic.gov.au/apifaq    Links to the following information are also provided on the PTV website at http://ptv.vic.gov.au/ptv-timetable-api/  * How to register for an API key and calculate a signature  * PTV Timetable API V2 to V3 Migration Guide  * Documentation for Version 2 of the PTV Timetable API  * PTV Timetable API Data Quality Statement    All information about how to use the API is in this documentation. PTV cannot provide technical support for the API.    Credits: This page has been based on Steve Bennett's http://opentransportdata.org/, used with permission.    # noqa: E501
  
      OpenAPI spec version: v3
      
      Generated by: https://github.com/swagger-api/swagger-codegen.git
  """
  
  
  from __future__ import absolute_import
  
  import re  # noqa: F401
  
  # python 2 and python 3 compatibility library
  import six
  
  from ptvapi.api_client import ApiClient
  
  
  class DeparturesApi(object):
      """NOTE: This class is auto generated by the swagger code generator program.
  
      Do not edit the class manually.
      Ref: https://github.com/swagger-api/swagger-codegen
      """
  
      def __init__(self, api_client=None):
          if api_client is None:
              api_client = ApiClient()
          self.api_client = api_client
  
      def departures_get_for_stop(self, route_type, stop_id, **kwargs):  # noqa: E501
          """View departures for all routes from a stop  # noqa: E501
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please pass async_req=True
          >>> thread = api.departures_get_for_stop(route_type, stop_id, async_req=True)
          >>> result = thread.get()
  
          :param async_req bool
          :param int route_type: Number identifying transport mode; values returned via RouteTypes API (required)
          :param int stop_id: Identifier of stop; values returned by Stops API (required)
          :param list[int] platform_numbers: Filter by platform number at stop
          :param int direction_id: Filter by identifier of direction of travel; values returned by Directions API - /v3/directions/route/{route_id}
          :param bool look_backwards: Indicates if filtering runs (and their departures) to those that arrive at destination before date_utc (default = false). Requires max_results &gt; 0.
          :param bool gtfs: Indicates that stop_id parameter will accept \"GTFS stop_id\" data
          :param datetime date_utc: Filter by the date and time of the request (ISO 8601 UTC format) (default = current date and time)
          :param int max_results: Maximum number of results returned
          :param bool include_cancelled: Indicates if cancelled services (if they exist) are returned (default = false) - metropolitan train only
          :param list[str] expand: List objects to be returned in full (i.e. expanded) - options include: all, stop, route, run, direction, disruption
          :param str token: Please ignore
          :param str devid: Your developer id
          :param str signature: Authentication signature for request
          :return: V3DeparturesResponse
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('async_req'):
              return self.departures_get_for_stop_with_http_info(route_type, stop_id, **kwargs)  # noqa: E501
          else:
              (data) = self.departures_get_for_stop_with_http_info(route_type, stop_id, **kwargs)  # noqa: E501
              return data
  
      def departures_get_for_stop_with_http_info(self, route_type, stop_id, **kwargs):  # noqa: E501
          """View departures for all routes from a stop  # noqa: E501
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please pass async_req=True
          >>> thread = api.departures_get_for_stop_with_http_info(route_type, stop_id, async_req=True)
          >>> result = thread.get()
  
          :param async_req bool
          :param int route_type: Number identifying transport mode; values returned via RouteTypes API (required)
          :param int stop_id: Identifier of stop; values returned by Stops API (required)
          :param list[int] platform_numbers: Filter by platform number at stop
          :param int direction_id: Filter by identifier of direction of travel; values returned by Directions API - /v3/directions/route/{route_id}
          :param bool look_backwards: Indicates if filtering runs (and their departures) to those that arrive at destination before date_utc (default = false). Requires max_results &gt; 0.
          :param bool gtfs: Indicates that stop_id parameter will accept \"GTFS stop_id\" data
          :param datetime date_utc: Filter by the date and time of the request (ISO 8601 UTC format) (default = current date and time)
          :param int max_results: Maximum number of results returned
          :param bool include_cancelled: Indicates if cancelled services (if they exist) are returned (default = false) - metropolitan train only
          :param list[str] expand: List objects to be returned in full (i.e. expanded) - options include: all, stop, route, run, direction, disruption
          :param str token: Please ignore
          :param str devid: Your developer id
          :param str signature: Authentication signature for request
          :return: V3DeparturesResponse
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['route_type', 'stop_id', 'platform_numbers', 'direction_id', 'look_backwards', 'gtfs', 'date_utc', 'max_results', 'include_cancelled', 'expand', 'token', 'devid', 'signature']  # noqa: E501
          all_params.append('async_req')
          all_params.append('_return_http_data_only')
          all_params.append('_preload_content')
          all_params.append('_request_timeout')
  
          params = locals()
          for key, val in six.iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method departures_get_for_stop" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'route_type' is set
          if ('route_type' not in params or
                  params['route_type'] is None):
              raise ValueError("Missing the required parameter `route_type` when calling `departures_get_for_stop`")  # noqa: E501
          # verify the required parameter 'stop_id' is set
          if ('stop_id' not in params or
                  params['stop_id'] is None):
              raise ValueError("Missing the required parameter `stop_id` when calling `departures_get_for_stop`")  # noqa: E501
  
          collection_formats = {}
  
          path_params = {}
          if 'route_type' in params:
              path_params['route_type'] = params['route_type']  # noqa: E501
          if 'stop_id' in params:
              path_params['stop_id'] = params['stop_id']  # noqa: E501
  
          query_params = []
          if 'platform_numbers' in params:
              query_params.append(('platform_numbers', params['platform_numbers']))  # noqa: E501
              collection_formats['platform_numbers'] = 'multi'  # noqa: E501
          if 'direction_id' in params:
              query_params.append(('direction_id', params['direction_id']))  # noqa: E501
          if 'look_backwards' in params:
              query_params.append(('look_backwards', params['look_backwards']))  # noqa: E501
          if 'gtfs' in params:
              query_params.append(('gtfs', params['gtfs']))  # noqa: E501
          if 'date_utc' in params:
              query_params.append(('date_utc', params['date_utc']))  # noqa: E501
          if 'max_results' in params:
              query_params.append(('max_results', params['max_results']))  # noqa: E501
          if 'include_cancelled' in params:
              query_params.append(('include_cancelled', params['include_cancelled']))  # noqa: E501
          if 'expand' in params:
              query_params.append(('expand', params['expand']))  # noqa: E501
              collection_formats['expand'] = 'multi'  # noqa: E501
          if 'token' in params:
              query_params.append(('token', params['token']))  # noqa: E501
          if 'devid' in params:
              query_params.append(('devid', params['devid']))  # noqa: E501
          if 'signature' in params:
              query_params.append(('signature', params['signature']))  # noqa: E501
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.select_header_accept(
              ['application/json', 'text/json', 'text/html'])  # noqa: E501
  
          # Authentication setting
          auth_settings = []  # noqa: E501
  
          return self.api_client.call_api(
              '/v3/departures/route_type/{route_type}/stop/{stop_id}', 'GET',
              path_params,
              query_params,
              header_params,
              body=body_params,
              post_params=form_params,
              files=local_var_files,
              response_type='V3DeparturesResponse',  # noqa: E501
              auth_settings=auth_settings,
              async_req=params.get('async_req'),
              _return_http_data_only=params.get('_return_http_data_only'),
              _preload_content=params.get('_preload_content', True),
              _request_timeout=params.get('_request_timeout'),
              collection_formats=collection_formats)
  
      def departures_get_for_stop_and_route(self, route_type, stop_id, route_id, **kwargs):  # noqa: E501
          """View departures for a specific route from a stop  # noqa: E501
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please pass async_req=True
          >>> thread = api.departures_get_for_stop_and_route(route_type, stop_id, route_id, async_req=True)
          >>> result = thread.get()
  
          :param async_req bool
          :param int route_type: Number identifying transport mode; values returned via RouteTypes API (required)
          :param int stop_id: Identifier of stop; values returned by Stops API (required)
          :param str route_id: Identifier of route; values returned by Routes API - v3/routes (required)
          :param int direction_id: Filter by identifier of direction of travel; values returned by Directions API - /v3/directions/route/{route_id}
          :param bool look_backwards: Indicates if filtering runs (and their departures) to those that arrive at destination before date_utc (default = false). Requires max_results &gt; 0.
          :param bool gtfs: Indicates that stop_id parameter will accept \"GTFS stop_id\" data
          :param datetime date_utc: Filter by the date and time of the request (ISO 8601 UTC format) (default = current date and time)
          :param int max_results: Maximum number of results returned
          :param bool include_cancelled: Indicates if cancelled services (if they exist) are returned (default = false) - metropolitan train only
          :param list[str] expand: List objects to be returned in full (i.e. expanded) - options include: all, stop, route, run, direction, disruption
          :param str token: Please ignore
          :param str devid: Your developer id
          :param str signature: Authentication signature for request
          :return: V3DeparturesResponse
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('async_req'):
              return self.departures_get_for_stop_and_route_with_http_info(route_type, stop_id, route_id, **kwargs)  # noqa: E501
          else:
              (data) = self.departures_get_for_stop_and_route_with_http_info(route_type, stop_id, route_id, **kwargs)  # noqa: E501
              return data
  
      def departures_get_for_stop_and_route_with_http_info(self, route_type, stop_id, route_id, **kwargs):  # noqa: E501
          """View departures for a specific route from a stop  # noqa: E501
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please pass async_req=True
          >>> thread = api.departures_get_for_stop_and_route_with_http_info(route_type, stop_id, route_id, async_req=True)
          >>> result = thread.get()
  
          :param async_req bool
          :param int route_type: Number identifying transport mode; values returned via RouteTypes API (required)
          :param int stop_id: Identifier of stop; values returned by Stops API (required)
          :param str route_id: Identifier of route; values returned by Routes API - v3/routes (required)
          :param int direction_id: Filter by identifier of direction of travel; values returned by Directions API - /v3/directions/route/{route_id}
          :param bool look_backwards: Indicates if filtering runs (and their departures) to those that arrive at destination before date_utc (default = false). Requires max_results &gt; 0.
          :param bool gtfs: Indicates that stop_id parameter will accept \"GTFS stop_id\" data
          :param datetime date_utc: Filter by the date and time of the request (ISO 8601 UTC format) (default = current date and time)
          :param int max_results: Maximum number of results returned
          :param bool include_cancelled: Indicates if cancelled services (if they exist) are returned (default = false) - metropolitan train only
          :param list[str] expand: List objects to be returned in full (i.e. expanded) - options include: all, stop, route, run, direction, disruption
          :param str token: Please ignore
          :param str devid: Your developer id
          :param str signature: Authentication signature for request
          :return: V3DeparturesResponse
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['route_type', 'stop_id', 'route_id', 'direction_id', 'look_backwards', 'gtfs', 'date_utc', 'max_results', 'include_cancelled', 'expand', 'token', 'devid', 'signature']  # noqa: E501
          all_params.append('async_req')
          all_params.append('_return_http_data_only')
          all_params.append('_preload_content')
          all_params.append('_request_timeout')
  
          params = locals()
          for key, val in six.iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method departures_get_for_stop_and_route" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'route_type' is set
          if ('route_type' not in params or
                  params['route_type'] is None):
              raise ValueError("Missing the required parameter `route_type` when calling `departures_get_for_stop_and_route`")  # noqa: E501
          # verify the required parameter 'stop_id' is set
          if ('stop_id' not in params or
                  params['stop_id'] is None):
              raise ValueError("Missing the required parameter `stop_id` when calling `departures_get_for_stop_and_route`")  # noqa: E501
          # verify the required parameter 'route_id' is set
          if ('route_id' not in params or
                  params['route_id'] is None):
              raise ValueError("Missing the required parameter `route_id` when calling `departures_get_for_stop_and_route`")  # noqa: E501
  
          collection_formats = {}
  
          path_params = {}
          if 'route_type' in params:
              path_params['route_type'] = params['route_type']  # noqa: E501
          if 'stop_id' in params:
              path_params['stop_id'] = params['stop_id']  # noqa: E501
          if 'route_id' in params:
              path_params['route_id'] = params['route_id']  # noqa: E501
  
          query_params = []
          if 'direction_id' in params:
              query_params.append(('direction_id', params['direction_id']))  # noqa: E501
          if 'look_backwards' in params:
              query_params.append(('look_backwards', params['look_backwards']))  # noqa: E501
          if 'gtfs' in params:
              query_params.append(('gtfs', params['gtfs']))  # noqa: E501
          if 'date_utc' in params:
              query_params.append(('date_utc', params['date_utc']))  # noqa: E501
          if 'max_results' in params:
              query_params.append(('max_results', params['max_results']))  # noqa: E501
          if 'include_cancelled' in params:
              query_params.append(('include_cancelled', params['include_cancelled']))  # noqa: E501
          if 'expand' in params:
              query_params.append(('expand', params['expand']))  # noqa: E501
              collection_formats['expand'] = 'multi'  # noqa: E501
          if 'token' in params:
              query_params.append(('token', params['token']))  # noqa: E501
          if 'devid' in params:
              query_params.append(('devid', params['devid']))  # noqa: E501
          if 'signature' in params:
              query_params.append(('signature', params['signature']))  # noqa: E501
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.select_header_accept(
              ['application/json', 'text/json', 'text/html'])  # noqa: E501
  
          # Authentication setting
          auth_settings = []  # noqa: E501
  
          return self.api_client.call_api(
              '/v3/departures/route_type/{route_type}/stop/{stop_id}/route/{route_id}', 'GET',
              path_params,
              query_params,
              header_params,
              body=body_params,
              post_params=form_params,
              files=local_var_files,
              response_type='V3DeparturesResponse',  # noqa: E501
              auth_settings=auth_settings,
              async_req=params.get('async_req'),
              _return_http_data_only=params.get('_return_http_data_only'),
              _preload_content=params.get('_preload_content', True),
              _request_timeout=params.get('_request_timeout'),
              collection_formats=collection_formats)
  