openbitapp/otp-client

dev-main 2023-06-23 19:45 UTC

This package is auto-updated.

Last update: 2024-04-23 21:33:28 UTC


README

OTP API

Installation & Usage

Requirements

PHP 7.3 and later. Should also work with PHP 8.0 but has not been tested.

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/openbitapp/otp-client.git"
    }
  ],
  "require": {
    "openbitapp/otp-client": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/OTPClient/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');




$apiInstance = new OpenBitApp\OTPClient\Api\OtpApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$from_place = 'from_place_example'; // string
$to_place = 'to_place_example'; // string
$date = 'date_example'; // string
$time = 'time_example'; // string
$arrive_by = True; // bool
$mode = 'mode_example'; // string
$lang = 'lang_example'; // string
$show_intermediate_stops = True; // bool
$max_walk_distance = 3.4; // float
$wait_reluctance = 3.4; // float
$walk_reluctance = 3.4; // float
$preferred_agencies = 'preferred_agencies_example'; // string
$preferred_routes = 'preferred_routes_example'; // string
$banned_agencies = 'banned_agencies_example'; // string
$banned_routes = 'banned_routes_example'; // string
$banned_stops = 'banned_stops_example'; // string
$banned_trips = 'banned_trips_example'; // string
$unpreferred_agencies = 'unpreferred_agencies_example'; // string
$unpreferred_routes = 'unpreferred_routes_example'; // string
$transfer_penalty = 'transfer_penalty_example'; // string
$num_itineraries = 56; // int
$min_transfer_time = 56; // int
$search_window = 'search_window_example'; // string

try {
    $result = $apiInstance->getPlan($from_place, $to_place, $date, $time, $arrive_by, $mode, $lang, $show_intermediate_stops, $max_walk_distance, $wait_reluctance, $walk_reluctance, $preferred_agencies, $preferred_routes, $banned_agencies, $banned_routes, $banned_stops, $banned_trips, $unpreferred_agencies, $unpreferred_routes, $transfer_penalty, $num_itineraries, $min_transfer_time, $search_window);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling OtpApi->getPlan: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

All URIs are relative to https://otp.bitapp.it/v2/otp

Class Method HTTP request Description
OtpApi getPlan GET /routers/default/plan Calcolo percorso

Models

Authorization

All endpoints do not require authorization.

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen