girabot

command module
v0.0.0-...-74db963 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 33 Imported by: 0

README

girabot

An alternative client for Lisbon's Gira bike sharing service.

Install

go install github.com/jilyaluk/girabot@latest
export TOKEN=<your telegram bot token>
girabot -h

Details

Your usual telegram bot. SQLite storage. telebot is used for telegram API.

In current setup bot is expected to be run behind a reverse proxy, which is responsible for SSL termination.

Set -domain and -url-prefix accordingly, and confugure your reverse proxy to forward requests to the bot port.

Gira API details

Gira has two API endpoints:

  • Auth API
  • GraphQL API

Auth API is implemented in internal/giraauth package. It is used to get a JWT token for GraphQL API. It exchanges login-password for an access and refresh tokens pair. Refresh token is valid for 7 days, while access token for 2 minutes.

GraphQL API is implemented in internal/gira package. The main logic lies here. GraphQL API is what you would expect and has introspection, so it is easy to understand what queries it supports. Authentication is done via standard HTTP authorization/bearer header.

Beware that APIs return errors half of the time, so be prepared to retry requests.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL