mirror of
https://codeberg.org/andyscott/OpenWeather-gRPC-API.git
synced 2024-12-21 12:13:09 -05:00
Updated README
This commit is contained in:
parent
e3c2b592a2
commit
56d13b2adf
1 changed files with 20 additions and 3 deletions
23
README.md
23
README.md
|
@ -6,8 +6,22 @@ The service uses [protocol buffers](https://developers.google.com/protocol-buffe
|
||||||
to define a [gRPC API](https://grpc.io/docs/what-is-grpc/introduction/) that
|
to define a [gRPC API](https://grpc.io/docs/what-is-grpc/introduction/) that
|
||||||
fetches current and extended weather data.
|
fetches current and extended weather data.
|
||||||
|
|
||||||
Weather data is obtained from [OpenWeather's](https://openweathermap.org/api)
|
Weather and geolocation data is obtained from
|
||||||
high-end servers.
|
[OpenWeatherMap.org](https://openweathermap.org/api).
|
||||||
|
At minimum, an API key that can access the the
|
||||||
|
[Current weather](https://openweathermap.org/current),
|
||||||
|
[Daily Forecast 16 Days](https://openweathermap.org/forecast16), and
|
||||||
|
[Geocoding](https://openweathermap.org/api/geocoding-api) APIs is
|
||||||
|
required.
|
||||||
|
|
||||||
|
Before starting the server a file named `.env` must be be added to the
|
||||||
|
root directory of the project, or the directory that contains the binary file,
|
||||||
|
with the following fields:
|
||||||
|
|
||||||
|
```
|
||||||
|
API_KEY=xxxxxxxxxxxxxxxx
|
||||||
|
PORT=xxxxx
|
||||||
|
```
|
||||||
|
|
||||||
## Sending Requests
|
## Sending Requests
|
||||||
|
|
||||||
|
@ -15,6 +29,7 @@ high-end servers.
|
||||||
|
|
||||||
1. Generate the necessary code for your preferred language from the files in
|
1. Generate the necessary code for your preferred language from the files in
|
||||||
the proto directory with the protoc compiler
|
the proto directory with the protoc compiler
|
||||||
|
- Note that the `protoc-gen-go` and `protoc-gen-go-grpc` plugins must be installed
|
||||||
2. Import the code into your project
|
2. Import the code into your project
|
||||||
3. Use the imported code to allow your client to connect with the server
|
3. Use the imported code to allow your client to connect with the server
|
||||||
4. Use the imported code within your own functions to make requests
|
4. Use the imported code within your own functions to make requests
|
||||||
|
@ -74,12 +89,14 @@ See the [test-client](test-client/current.go) for more details.
|
||||||
|
|
||||||
## Receiving the response
|
## Receiving the response
|
||||||
|
|
||||||
Data will be sent to your client as JSON. Example from the above call:
|
Data will be sent to your client as JSON when requesting forecasts. Example from the above call:
|
||||||
|
|
||||||
```
|
```
|
||||||
{"coord":{"lon":-123.262,"lat":44.5646},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"base":"stations","main":{"temp":296.87,"feels_like":297.13,"temp_min":294.98,"temp_max":298.62,"pressure":1007,"humidity":70},"visibility":10000,"wind":{"speed":2.14,"deg":284,"gust":1.94},"clouds":{"all":0},"dt":1658811503,"sys":{"type":2,"id":2005452,"country":"US","sunrise":1658753522,"sunset":1658807208},"timezone":-25200,"id":5720727,"name":"Corvallis","cod":200}
|
{"coord":{"lon":-123.262,"lat":44.5646},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"base":"stations","main":{"temp":296.87,"feels_like":297.13,"temp_min":294.98,"temp_max":298.62,"pressure":1007,"humidity":70},"visibility":10000,"wind":{"speed":2.14,"deg":284,"gust":1.94},"clouds":{"all":0},"dt":1658811503,"sys":{"type":2,"id":2005452,"country":"US","sunrise":1658753522,"sunset":1658807208},"timezone":-25200,"id":5720727,"name":"Corvallis","cod":200}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Geolocation requests return a pair of floats representing the latitude and longitude for the given location.
|
||||||
|
|
||||||
## UML Diagram
|
## UML Diagram
|
||||||
|
|
||||||
![UML diagram](info/UML.png)
|
![UML diagram](info/UML.png)
|
||||||
|
|
Loading…
Reference in a new issue