Esempio n. 1
0
        static void Main(string[] args)
        {
            // request object
            D2DRequest req = new D2DRequest();

            // I want to get to my destination at the datetime bellow
            req.desiredOutboundDate = DateTime.ParseExact("2014-10-15T20:00:00", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture);
            req.outboundDateKind    = D2dRequestTripDateKind.arriveAt;

            // I want to leave my destination at the datetime bellow
            req.desiredInboundDate = DateTime.ParseExact("2014-10-17T20:00:00", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture);
            req.outboundDateKind   = D2dRequestTripDateKind.departureAt;

            // specifying the origin
            req.oriLocation      = new D2DRequestLocation();
            req.oriLocation.lat  = "-23.5732853";
            req.oriLocation.lng  = "-46.64167550000002";
            req.oriLocation.type = "street_address";

            // specifying the destination
            req.destLocation      = new D2DRequestLocation();
            req.destLocation.lat  = "52.3661876";
            req.destLocation.lng  = "4.899111500000004";
            req.destLocation.type = "route";

            // requesting public transp info as well
            req.flags = new D2DRequestFlags();
            req.flags.includePublicTransp = true;

            // submitting the request
            Door2Door         d2d  = new Door2Door(req);
            Door2DoorResponse resp = d2d.GetResponse();

            Console.WriteLine(JsonConvert.SerializeObject(resp));
        }
Esempio n. 2
0
 /// <summary>
 ///     Handles the communication between client and Rome2rio api.
 /// </summary>
 /// <param name="req">
 ///     Parameters for the request include coordinates of origin and destination,
 ///     arrival and return dates, external flight options and filters.
 /// </param>
 /// <param name="requestFlags">
 ///     Filters the response segment types.
 /// </param>
 internal Rome2RioComm(D2DRequest req, int requestFlags)
 {
     _requestFlags = requestFlags;
     _req          = req;
     _resp         = new Door2DoorResponse();
 }
Esempio n. 3
0
 /// <summary>
 ///
 /// </summary>
 public void Dispose()
 {
     _req  = null;
     _resp = null;
 }