This commit is contained in:
Troy Taylor 2024-03-07 01:24:28 -05:00 коммит произвёл GitHub
Родитель 6f29dfb063
Коммит 80f9557fc9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 234 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,170 @@
{
"swagger": "2.0",
"info": {
"title": "wttr.in",
"description": "wttr.in is a console-oriented weather forecast service that supports various information representation methods like terminal-oriented ANSI-sequences for console HTTP clients.",
"version": "1.0",
"contact": {
"name": "Troy Taylor",
"url": "https://www.hitachisolutions.com",
"email": "ttaylor@hitachisolutions.com"
}
},
"host": "wttr.in",
"basePath": "/",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"text/plain"
],
"paths": {
"/{location}": {
"get": {
"responses": {
"200": {
"description": "default",
"schema": {
"type": "string"
}
}
},
"summary": "Get weather",
"description": "Retrieve the weather information for the desired parameters.",
"operationId": "WeatherGet",
"parameters": [
{
"name": "location",
"in": "path",
"required": true,
"type": "string",
"x-ms-url-encoding": "single",
"x-ms-summary": "Location",
"description": "The location to retrieve the weather for. This can be a city name, point of interest, airport 3-letter code, domain name (with the @), area code, or GPS coordinates."
},
{
"name": "view",
"in": "query",
"x-ms-summary": "View",
"description": "The view format to return.",
"required": false,
"type": "string",
"enum": [
"1",
"2",
"A",
"d",
"n",
"q",
"Q",
"T"
],
"x-ms-enum-values": [
{
"displayName": "Current weather and today's forecast",
"value": "1"
},
{
"displayName": "Current weather and today and tomorrow's forecast",
"value": "2"
},
{
"displayName": "Ignore User-Agent and force ANSI output format",
"value": "A"
},
{
"displayName": "Restrict output to standard console font glyphs",
"value": "d"
},
{
"displayName": "Narrow version (only day and night)",
"value": "n"
},
{
"displayName": "Quiet version (no \"Weather report\" text)",
"value": "q"
},
{
"displayName": "Superquiet version (no \"Weather report\", no city name)",
"value": "Q"
},
{
"displayName": "Switch terminal sequences off (no colors)",
"value": "T"
}
]
},
{
"name": "lang",
"in": "query",
"x-ms-summary": "Language",
"description": "The language format for any text.",
"required": false,
"type": "string",
"default": "en",
"enum": [
"en",
"am",
"ar",
"af",
"be",
"bn",
"ca",
"da",
"de",
"el",
"et",
"fr",
"fa",
"gl",
"hi",
"hu",
"ia",
"id",
"it",
"lt",
"mg",
"nb",
"nl",
"oc",
"pl",
"pt-br",
"ro",
"ru",
"ta",
"tr",
"th",
"uk",
"vi",
"zh-cn",
"zh-tw"
]
}
]
}
}
},
"definitions": {},
"parameters": {},
"responses": {},
"securityDefinitions": {},
"security": [],
"tags": [],
"x-ms-connector-metadata": [
{
"propertyName": "Website",
"propertyValue": "https://github.com/chubin/wttr.in"
},
{
"propertyName": "Privacy policy",
"propertyValue": "https://github.com/chubin/wttr.in"
},
{
"propertyName": "Categories",
"propertyValue": "Data;Lifestyle and Entertainment"
}
]
}

Просмотреть файл

@ -0,0 +1,11 @@
{
"properties": {
"connectionParameters": {},
"iconBrandColor": "#da3b01",
"scriptOperations": [],
"capabilities": [],
"policyTemplateInstances": [],
"publisher": "Troy Taylor",
"stackOwner": "Igor Chubin"
}
}

Просмотреть файл

@ -0,0 +1,17 @@
# wttr.in
wttr.in is a console-oriented weather forecast service that supports various information representation methods like terminal-oriented ANSI-sequences for console HTTP clients.
## Publisher: Troy Taylor, Hitachi Solutions
## Prerequisites
There are no prerequisites needed to use this connector.
## Obtaining Credentials
There are no credentials needed to use this connector.
## Supported Operations
### Get weather
Retrieve the weather information for the desired parameters.
## Known Issues and Limitations
There are no known issues at this time.

Просмотреть файл

@ -0,0 +1,36 @@
public class script: ScriptBase
{
public override async Task<HttpResponseMessage> ExecuteAsync()
{
return await this.ConvertAndTransformOperation().ConfigureAwait(false);
}
private async Task<HttpResponseMessage> ConvertAndTransformOperation()
{
// Manipulate the response data before returning it
HttpResponseMessage response = await this.Context.SendAsync(this.Context.Request, this.CancellationToken).ConfigureAwait(continueOnCapturedContext: false);
var responseString = await response.Content.ReadAsStringAsync().ConfigureAwait(continueOnCapturedContext: false);
// Remove the set string from the response string
string htmlString = @"
<a href=""https://twitter.com/igor_chubin?ref_src=twsrc%5Etfw"" class=""twitter-follow-button"" data-show-count=""false"">Follow @igor_chubin</a><script async src=""https://platform.twitter.com/widgets.js"" charset=""utf-8""></script>
<a aria-label=""Star chubin/wttr.in on GitHub"" data-count-aria-label=""# stargazers on GitHub"" data-count-api=""/repos/chubin/wttr.in#stargazers_count"" data-count-href=""/chubin/wttr.in/stargazers"" data-show-count=""true"" data-icon=""octicon-star"" href=""https://github.com/chubin/wttr.in"" class=""github-button"">wttr.in</a>
<!-- Place this tag where you want the button to render. -->
<a aria-label=""Star chubin/pyphoon on GitHub"" data-count-aria-label=""# stargazers on GitHub"" data-count-api=""/repos/chubin/pyphoon#stargazers_count"" data-count-href=""/chubin/pyphoon/stargazers"" data-show-count=""true"" data-icon=""octicon-star"" href=""https://github.com/chubin/pyphoon"" class=""github-button"">pyphoon</a>
<!-- Place this tag where you want the button to render. -->
<a aria-label=""Star schachmat/wego on GitHub"" data-count-aria-label=""# stargazers on GitHub"" data-count-api=""/repos/schachmat/wego#stargazers_count"" data-count-href=""/schachmat/wego/stargazers"" data-show-count=""true"" data-icon=""octicon-star"" href=""https://github.com/schachmat/wego"" class=""github-button"">wego</a>
<!-- Place this tag right after the last button or just before your close body tag. -->
<script async defer id=""github-bjs"" src=""https://buttons.github.io/buttons.js""></script>
";
responseString = responseString.Replace(htmlString, "");
// Update the response content with the modified string
response.Content = new StringContent(responseString, Encoding.UTF8, "text/html");
return response;
}
}