From 0564225a6e92528e849d51a8e1abf663f24f5f7a Mon Sep 17 00:00:00 2001 From: haimantika mitra <32809211+Haimantika@users.noreply.github.com> Date: Fri, 22 Oct 2021 05:03:57 +0530 Subject: [PATCH] Weather Forecast (Independent Publisher) (#1149) * Weather Forecast (Independent Publisher) Changes * Weather Forecast (Independent Publisher) Changes --- .../WeatherForecast/README.md | 40 +++ .../apiDefinition.swagger.json | 248 ++++++++++++++++++ .../WeatherForecast/apiProperties.json | 36 +++ 3 files changed, 324 insertions(+) create mode 100644 independent-publisher-connectors/WeatherForecast/README.md create mode 100644 independent-publisher-connectors/WeatherForecast/apiDefinition.swagger.json create mode 100644 independent-publisher-connectors/WeatherForecast/apiProperties.json diff --git a/independent-publisher-connectors/WeatherForecast/README.md b/independent-publisher-connectors/WeatherForecast/README.md new file mode 100644 index 000000000..3a0c5345d --- /dev/null +++ b/independent-publisher-connectors/WeatherForecast/README.md @@ -0,0 +1,40 @@ +# Weather Forecast Connector +This connector will help you have weather forecast of cities you look for. It can give accurate results of upto 3 days in advance. + +## Publisher: Haimantika Mitra + +## Prerequisites +You will need the following: +- A Microsoft Power Apps or Power Automate plan with custom connector feature +- An account on https://openweathermap.org/ +- [API Key] (https://openweathermap.org/) + +## Obtaining Credentials +- Sign in to https://openweathermap.org/. +- Locate 'My API keys' under your profile. +- Generate keys. Use the generated key for aunthentication + +## Supported Operations +This connector will help you have weather forecast of the requested city. It returns the following data: +- coordinates +- temperature (max,min) +- pressure +- humidity +- sea level +- ground level +- visibility +- clouds +- wind (speed,deg, gust) +- sunrise, sunset + +## Known Issues and Limitations +Limitation: +- You can query only one city at a time. + +## Deployment Instructions +1. Clone the PowerPlatformConnectors GitHub repository +2. Open a terminal, then change to the WeatherForecast directory, found in samples of the cloned repository +3. Run `paconn login`, then follow the authentication steps +4. Once authenticated, run paconn create --api-def apiDefinition.swagger.json --api-prop apiProperties.json +5. Select the target environment for your connector +6. Create a new flow in Power Automate, or a new Power App, using the connector. When prompted, create a new connection with your API Key and city whose weather forecast you want to know. 'q' will be the city, along with the country code, and your 'appid' will be the authentication key. \ No newline at end of file diff --git a/independent-publisher-connectors/WeatherForecast/apiDefinition.swagger.json b/independent-publisher-connectors/WeatherForecast/apiDefinition.swagger.json new file mode 100644 index 000000000..0193370d7 --- /dev/null +++ b/independent-publisher-connectors/WeatherForecast/apiDefinition.swagger.json @@ -0,0 +1,248 @@ +{ + "swagger": "2.0", + "info": { + "title": "Weather Forecast", + "description": "The weather forecast connector helps one to get weather forecast depending on the city of their choice", + "version": "1.0", + "contact": { + "name": "Haimantika Mitra", + "url": "https://openweathermap.org/", + "email": "haimantikamitra@gmail.com" + } + }, + "host": "api.openweathermap.org", + "basePath": "/", + "schemes": [ + "https" + ], + "consumes": [], + "produces": [], + "paths": { + "/data/2.5/weather": { + "get": { + "responses": { + "default": { + "description": "default", + "schema": { + "type": "object", + "properties": { + "coord": { + "type": "object", + "properties": { + "lon": { + "type": "number", + "format": "float", + "description": "longitude" + }, + "lat": { + "type": "number", + "format": "float", + "description": "latitude" + } + }, + "description": "coordinates" + }, + "weather": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32", + "description": "id" + }, + "main": { + "type": "string", + "description": "main" + }, + "description": { + "type": "string", + "description": "description" + }, + "icon": { + "type": "string", + "description": "icon" + } + } + }, + "description": "weather" + }, + "base": { + "type": "string", + "description": "base" + }, + "main": { + "type": "object", + "properties": { + "temp": { + "type": "number", + "format": "float", + "description": "temperature" + }, + "feels_like": { + "type": "number", + "format": "float", + "description": "weather feels" + }, + "temp_min": { + "type": "number", + "format": "float", + "description": "minimum temperature" + }, + "temp_max": { + "type": "number", + "format": "float", + "description": "maximum temperature" + }, + "pressure": { + "type": "integer", + "format": "int32", + "description": "pressure" + }, + "humidity": { + "type": "integer", + "format": "int32", + "description": "humidity" + }, + "sea_level": { + "type": "integer", + "format": "int32", + "description": "sea level" + }, + "grnd_level": { + "type": "integer", + "format": "int32", + "description": "ground level" + } + }, + "description": "main" + }, + "visibility": { + "type": "integer", + "format": "int32", + "description": "visibility" + }, + "wind": { + "type": "object", + "properties": { + "speed": { + "type": "number", + "format": "float", + "description": "speed" + }, + "deg": { + "type": "integer", + "format": "int32", + "description": "degree" + } + }, + "description": "wind" + }, + "clouds": { + "type": "object", + "properties": { + "all": { + "type": "integer", + "format": "int32", + "description": "all" + } + }, + "description": "clouds" + }, + "dt": { + "type": "integer", + "format": "int32", + "description": "district" + }, + "sys": { + "type": "object", + "properties": { + "country": { + "type": "string", + "description": "country" + }, + "sunrise": { + "type": "integer", + "format": "int32", + "description": "sunrise" + }, + "sunset": { + "type": "integer", + "format": "int32", + "description": "sunset" + } + }, + "description": "sys" + }, + "timezone": { + "type": "integer", + "format": "int32", + "description": "timezone" + }, + "id": { + "type": "integer", + "format": "int32", + "description": "id" + }, + "name": { + "type": "string", + "description": "name" + }, + "cod": { + "type": "integer", + "format": "int32", + "description": "cod" + } + } + } + } + }, + "summary": "Get Weather info", + "description": "This returns weather info depnding on city of choice", + "operationId": "city", + "x-ms-visibility": "important", + "parameters": [ + { + "name": "q", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "appid", + "in": "query", + "required": false, + "type": "string" + } + ] + } + } + }, + "definitions": {}, + "parameters": {}, + "responses": {}, + "securityDefinitions": { + "api_key": { + "type": "apiKey", + "in": "header", + "name": "Authorization" + } + }, + "security": [], + "tags": [], + "x-ms-connector-metadata": [ + { + "propertyName": "Website", + "propertyValue": "https://openweathermap.org/" + }, + { + "propertyName": "Privacy policy", + "propertyValue": "https://home.openweathermap.org/questions" + }, + { + "propertyName": "Categories", + "propertyValue": "Data" + } + ] +} \ No newline at end of file diff --git a/independent-publisher-connectors/WeatherForecast/apiProperties.json b/independent-publisher-connectors/WeatherForecast/apiProperties.json new file mode 100644 index 000000000..7fd6d96d3 --- /dev/null +++ b/independent-publisher-connectors/WeatherForecast/apiProperties.json @@ -0,0 +1,36 @@ +{ + "properties": { + "capabilities": [], + "connectionParameters": { + "password": { + "type": "securestring", + "uiDefinition": { + "constraints": { + "clearText": false, + "required": "true", + "tabIndex": 3 + }, + "description": "The city you want to know the weather forecast of", + "displayName": "q", + "tooltip": "Provide the city along with country code" + } + }, + "appid": { + "type": "securestring", + "uiDefinition": { + "constraints": { + "clearText": true, + "required": "true", + "tabIndex": 2 + }, + "description": "The API key of this API", + "displayName": "appid", + "tooltip": "Provide the API Key" + } + } + }, + "iconBrandColor": "#da3b01", + "publisher": "Haimantika Mitra", + "stackOwner": "OpenWeatherMap Ltd." + } +} \ No newline at end of file