Add wikipedia api client, add wikipedia command, show errors in chat when debugging
This commit is contained in:
parent
f4ced55d15
commit
846c928f5f
18 changed files with 334 additions and 9 deletions
14
WikipediaApi/Page/PageApiUrls.cs
Normal file
14
WikipediaApi/Page/PageApiUrls.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
|
||||
namespace WikipediaApi.Page
|
||||
{
|
||||
public class PageApiUrls
|
||||
{
|
||||
public Uri Summary { get; set; }
|
||||
public Uri Metadata { get; set; }
|
||||
public Uri References { get; set; }
|
||||
public Uri Media { get; set; }
|
||||
public Uri EditHtml { get; set; }
|
||||
public Uri TalkPageHtml { get; set; }
|
||||
}
|
||||
}
|
8
WikipediaApi/Page/PageContentUrlCollection.cs
Normal file
8
WikipediaApi/Page/PageContentUrlCollection.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace WikipediaApi.Page
|
||||
{
|
||||
public class PageContentUrlCollection
|
||||
{
|
||||
public PageContentUrls Desktop { get; set; }
|
||||
public PageContentUrls Mobile { get; set; }
|
||||
}
|
||||
}
|
12
WikipediaApi/Page/PageContentUrls.cs
Normal file
12
WikipediaApi/Page/PageContentUrls.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace WikipediaApi.Page
|
||||
{
|
||||
public class PageContentUrls
|
||||
{
|
||||
public Uri Page { get; set; }
|
||||
public Uri Revisions { get; set; }
|
||||
public Uri Edit { get; set; }
|
||||
public Uri Talk { get; set; }
|
||||
}
|
||||
}
|
8
WikipediaApi/Page/PageCoordinates.cs
Normal file
8
WikipediaApi/Page/PageCoordinates.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace WikipediaApi.Page
|
||||
{
|
||||
public class PageCoordinates
|
||||
{
|
||||
public float lat { get; set; }
|
||||
public float lon { get; set; }
|
||||
}
|
||||
}
|
12
WikipediaApi/Page/PageImage.cs
Normal file
12
WikipediaApi/Page/PageImage.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace WikipediaApi.Page
|
||||
{
|
||||
public class PageImage
|
||||
{
|
||||
public Uri Source { get; set; }
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
|
||||
}
|
||||
}
|
8
WikipediaApi/Page/PageNamespace.cs
Normal file
8
WikipediaApi/Page/PageNamespace.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace WikipediaApi.Page
|
||||
{
|
||||
public class PageNamespace
|
||||
{
|
||||
public ulong Id { get; set; }
|
||||
public string Text { get; set; }
|
||||
}
|
||||
}
|
68
WikipediaApi/Page/PagePreview.cs
Normal file
68
WikipediaApi/Page/PagePreview.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace WikipediaApi.Page
|
||||
{
|
||||
public class PagePreview
|
||||
{
|
||||
[JsonProperty("type")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public PageTypes Type { get; set; } = PageTypes.NoExtract;
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; }
|
||||
|
||||
[JsonProperty("displaytitle")]
|
||||
public string Displaytitle { get; set; }
|
||||
|
||||
[JsonProperty("namespace")]
|
||||
public PageNamespace @Namespace { get; set; }
|
||||
|
||||
[JsonProperty("titles")]
|
||||
public PageTitles Titles { get; set; }
|
||||
|
||||
[JsonProperty("pageid")]
|
||||
public ulong Pageid { get; set; }
|
||||
|
||||
[JsonProperty("thumbnail")]
|
||||
public PageImage Thumbnail { get; set; }
|
||||
|
||||
[JsonProperty("originalimage")]
|
||||
public PageImage Originalimage { get; set; }
|
||||
|
||||
[JsonProperty("lang")]
|
||||
public string Lang { get; set; }
|
||||
|
||||
[JsonProperty("dir")]
|
||||
public string Dir { get; set; }
|
||||
|
||||
[JsonProperty("revision")]
|
||||
public ulong Revision { get; set; }
|
||||
|
||||
[JsonProperty("tid")]
|
||||
public string Tid { get; set; }
|
||||
|
||||
[JsonProperty("timestamp")]
|
||||
public DateTimeOffset Timestamp { get; set; }
|
||||
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[JsonProperty("coordinates")]
|
||||
public PageCoordinates Coordinates { get; set; }
|
||||
|
||||
[JsonProperty("content_urls")]
|
||||
public PageContentUrlCollection ContentUrls { get; set; }
|
||||
|
||||
[JsonProperty("api_urls")]
|
||||
public PageApiUrls ApiUrls { get; set; }
|
||||
|
||||
[JsonProperty("extract")]
|
||||
public string Extract { get; set; }
|
||||
|
||||
[JsonProperty("extract_html")]
|
||||
public string ExtractHtml { get; set; }
|
||||
}
|
||||
}
|
10
WikipediaApi/Page/PageTitles.cs
Normal file
10
WikipediaApi/Page/PageTitles.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
namespace WikipediaApi.Page
|
||||
{
|
||||
public class PageTitles
|
||||
{
|
||||
public string Canonical { get; set; }
|
||||
public string Normalized { get; set; }
|
||||
public string Display { get; set; }
|
||||
|
||||
}
|
||||
}
|
19
WikipediaApi/Page/PageTypes.cs
Normal file
19
WikipediaApi/Page/PageTypes.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
using System.Runtime.Serialization;
|
||||
|
||||
namespace WikipediaApi.Page
|
||||
{
|
||||
public enum PageTypes
|
||||
{
|
||||
[EnumMember(Value = "standard")]
|
||||
Standard,
|
||||
|
||||
[EnumMember(Value = "disambiguation")]
|
||||
Disambiguation,
|
||||
|
||||
[EnumMember(Value = "mainpage")]
|
||||
MainPage,
|
||||
|
||||
[EnumMember(Value = "no-extract")]
|
||||
NoExtract
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue