{"id":13573357,"url":"https://github.com/CUTR-at-USF/opentripplanner-client-library","last_synced_at":"2025-04-04T12:30:56.841Z","repository":{"id":47645677,"uuid":"351619128","full_name":"CUTR-at-USF/opentripplanner-client-library","owner":"CUTR-at-USF","description":"A Kotlin Multiplatform Mobile client library for the OpenTripPlanner project (http://www.opentripplanner.org/) server (v2 and higher)","archived":true,"fork":false,"pushed_at":"2022-02-09T20:34:41.000Z","size":285,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-05T08:36:55.170Z","etag":null,"topics":["client","kotlin","kotlin-android","kotlin-library","kotlin-multiplatform","opentripplanner"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CUTR-at-USF.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-26T00:54:02.000Z","updated_at":"2024-05-27T16:56:41.000Z","dependencies_parsed_at":"2022-09-06T20:50:28.044Z","dependency_job_id":null,"html_url":"https://github.com/CUTR-at-USF/opentripplanner-client-library","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CUTR-at-USF%2Fopentripplanner-client-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CUTR-at-USF%2Fopentripplanner-client-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CUTR-at-USF%2Fopentripplanner-client-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CUTR-at-USF%2Fopentripplanner-client-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CUTR-at-USF","download_url":"https://codeload.github.com/CUTR-at-USF/opentripplanner-client-library/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247179505,"owners_count":20897054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","kotlin","kotlin-android","kotlin-library","kotlin-multiplatform","opentripplanner"],"created_at":"2024-08-01T15:00:33.639Z","updated_at":"2025-04-04T12:30:51.834Z","avatar_url":"https://github.com/CUTR-at-USF.png","language":"Kotlin","funding_links":[],"categories":["Uncategorized","Using Data"],"sub_categories":["Uncategorized","Consumer Apps"],"readme":"# OpenTripPlanner Client Library [![Gradle CI](https://github.com/CUTR-at-USF/opentripplanner-client-library/actions/workflows/gradle.yml/badge.svg)](https://github.com/CUTR-at-USF/opentripplanner-client-library/actions/workflows/gradle.yml)\n\nA Kotlin Multiplatform library for making API requests and parsing responses from an [OpenTripPlanner v2 server](http://www.opentripplanner.org/) for the following [OTP2 REST API](http://dev.opentripplanner.org/apidoc/2.0.0/index.html) endpoints:\n* [`/plan`](http://dev.opentripplanner.org/apidoc/2.0.0/resource_PlannerResource.html) - Trip planning from an origin to a destination\n* [`/bike_rental`](http://dev.opentripplanner.org/apidoc/2.0.0/resource_BikeRental.html) - List of bike rental stations\n* [`/otp`](http://dev.opentripplanner.org/apidoc/2.0.0/resource_ServerInfo.html) - Provides information about the OTP server (version, etc.)\n\nSupported platforms are:\n* Android\n* iOS\n* JVM (Java/Kotlin)\n\n## Example use (Android)\n\n#### Plan API\n\n```kotlin\nprivate lateinit var planApi: PlanApi\n...\nval requestParameters = RequestParameters(\n  fromPlace = latLong(41.84712, -87.64678),\n  toPlace = latLong(41.84584, -87.65214),\n  arriveBy = \"false\")\nplanApi = PlanApi(\"https://10.0.2.2:8080/otp/routers/default/plan\",  requestParameters)\nplanApi.getPlan(\n    success = { launch (Main) {\n        Log.d(TAG, \"logData: $it\")\n    } },\n    failure = ::handleError\n)\n```\n\nYou can set a URL parameter for an API key name and value (e.g., `plan?...\u0026key=ABCD...`) if needed with:\n\n```kotlin\n...\nplanApi = PlanApi(...)\nplanApi.apiKey(\"key\", \"ABCD\")\nplanApi.getPlan(\n...\n```\n\n#### Bike Rental API\n\n```kotlin\nprivate lateinit var bikeRentalApi: BikeRentalApi\n...\nbikeRentalApi = BikeRentalApi(\"https://10.0.2.2:8080/otp/routers/default/bike_rental\",\n    lowerLeft = latLong(41.81712, -87.62678),\n    upperRight = latLong(41.84584, -87.65214))\n\nbikeRentalApi.getBikeRental(\n    success = {launch (Main) { \n        Log.d(TAG, \"logData: $it\") \n    }},\n    failure = ::handleError\n)\n```\n\n#### Server Info API\n\n```kotlin\nprivate lateinit var serverInfoApi: ServerInfoApi\n...\nserverInfoApi = ServerInfoApi(\"https://10.0.2.2:8080/otp\")\nserverInfoApi.getServerInfo(\n    success = {launch (Main) { logData(it) }},\n    failure = ::handleError\n)\n```\n\n## Prerequisites\n\nIf you use Android Studio:\n1) Install [Android Studio](https://developer.android.com/studio) (preferably version `4.1.3` or higher).\n2) Before you import the project, install Kotlin MultiPlatform Mobile plugin via Settings (Preferences if on MacOS) -\u003e Plugins -\u003e Kotlin Multplatform Mobile -\u003e Install\n\nIf you build from the command line using Gradle:\n1) Install [Java JDK 8 or higher](https://www.oracle.com/java/technologies/javase-downloads.html)\n\n## Build\nImport the project into Android Studio\n\nAlternately, you can build from the command line using Gradle:\n\n`./gradlew build`\n\n## Testing\n1. [Set up an OTP2 server](http://docs.opentripplanner.org/en/latest/Basic-Tutorial/) on your local machine, or get the URL for a public OTP2 server\n1. If you're testing the demo Android app on an emulator, you can use the default hard-coded host in [MainActivity.kt](app/src/main/java/edu/usf/cutr/otp/demo/MainActivity.kt) of `10.0.2.2:8080`. If you're testing on a physical device, make sure to change the host and port number in the API constructors to match the computer on your local network running OTP.\n1. Click on the green play button on top to run the Android demo app. OTP API responses will be logged in LogCat with the tag `MainActivity`.\n\n## Release\nTo create a release of the library on each platform, run the following commands.\n\n#### Android\n\nThis command generates AAR files in `otp-client-library/build/outputs/aar`:\n\n```\n./gradlew :otp-client-library:build\n```\n\n#### iOS\n\nThis command generates Swift package files in `common/swiftpackage` directory:\n\n``` \n./gradlew createSwiftPackage\n```\n\n#### Desktop Java/Kotlin\n\nThis command generates four JAR files in `library/build/libs` and we encourage you to use `library-jvm-1.0.0.jar` for manually including dependencies:\n\n```\n./gradlew :otp-client-library:build\n```\n\nTo install to your local Maven repository you can run:\n\n```\n./gradlew publishToMavenLocal\n```\n\n...and include the dependency on this library in your application as:\n\n```groovy\nimplementation \"edu.usf.cutr.otp:otp-client-library-jvm:1.0.0\"\n```\n\n## License\n```\n/*\n * Copyright (C) 2021 University of South Florida\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCUTR-at-USF%2Fopentripplanner-client-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCUTR-at-USF%2Fopentripplanner-client-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCUTR-at-USF%2Fopentripplanner-client-library/lists"}