diff --git a/README.md b/README.md index 6b11c20..7781443 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Reddit .NET client +# Reddit.NET [![nuget][nuget-image]][nuget-url] [![status][status-image]][status-url] @@ -72,9 +72,8 @@ dotnet test ## Documentation -See the [docs](./docs/) folder for documentation on how to use the client and an overview of its internals. - -The documentation is also hosted on [GitHub pages](https://jeds6391.github.io/Reddit.NET/). +- [Usage and conceptual](https://jeds6391.github.io/Reddit.NET/) +- [API reference](https://reddit-net-api-docs.netlify.app/reference/index.html) [nuget-image]: https://img.shields.io/nuget/v/Reddit.NET.Client?style=flat-square [nuget-url]: https://www.nuget.org/packages/Reddit.NET.Client diff --git a/docs/api/.gitignore b/docs/api/.gitignore new file mode 100644 index 0000000..2781f6d --- /dev/null +++ b/docs/api/.gitignore @@ -0,0 +1,9 @@ +############### +# folder # +############### +/**/DROP/ +/**/TEMP/ +/**/packages/ +/**/bin/ +/**/obj/ +_site diff --git a/docs/api/docfx.json b/docs/api/docfx.json new file mode 100644 index 0000000..4edba6e --- /dev/null +++ b/docs/api/docfx.json @@ -0,0 +1,69 @@ +{ + "metadata": [ + { + "src": [ + { + "files": [ + "**.csproj" + ], + "exclude": [ "**/bin/**", "**/obj/**" ], + "src": "../../src" + } + ], + "dest": "reference" + } + ], + "build": { + "content": [ + { + "files": [ + "reference/**.yml", + "reference/index.md" + ] + }, + { + "files": [ + "toc.yml", + "*.md" + ] + } + ], + "resource": [ + { + "files": [ + "images/**" + ] + } + ], + "overwrite": [ + { + "files": [], + "exclude": [ + "obj/**", + "_site/**" + ] + } + ], + "dest": "_site", + "globalMetadataFiles": [], + "fileMetadataFiles": [], + "globalMetadata": { + "_appTitle": "Reddit.NET Documentation", + "_appFooter": "© Copyright 2021 Jed Simson", + "_appLogoPath": "", + "_appFaviconPath": "", + "_enableSearch": false + }, + "template": [ + "default", + "templates" + ], + "postProcessors": [], + "markdownEngineName": "markdig", + "noLangKeyword": false, + "keepFileLink": false, + "cleanupCacheHistory": false, + "disableGitFeatures": false, + "xrefService": [ "https://xref.docs.microsoft.com/query?uid={uid}" ] + } +} \ No newline at end of file diff --git a/docs/api/index.md b/docs/api/index.md new file mode 100644 index 0000000..28c248d --- /dev/null +++ b/docs/api/index.md @@ -0,0 +1,19 @@ +# Reddit.NET + +## About + +Provides a .NET client for interacting with [reddit](https://www.reddit.com). + +The client was designed with the following goals in mind: + +- Simple, modern, asynchronous API +- Support for various authentication modes +- Modular structure with simple re-usable components + +## Source code + +The client source code is available on [GitHub](https://github.com/JedS6391/Reddit.NET). + +## License + +Reddit.NET is licensed under the MIT License. diff --git a/docs/api/reference/.gitignore b/docs/api/reference/.gitignore new file mode 100644 index 0000000..f798527 --- /dev/null +++ b/docs/api/reference/.gitignore @@ -0,0 +1,5 @@ +############### +# temp file # +############### +*.yml +.manifest diff --git a/docs/api/reference/index.md b/docs/api/reference/index.md new file mode 100644 index 0000000..b80be1d --- /dev/null +++ b/docs/api/reference/index.md @@ -0,0 +1,3 @@ +# API Reference + +This section provides an API reference for the Reddit.NET client. diff --git a/docs/api/templates/partials/affix.tmpl.partial b/docs/api/templates/partials/affix.tmpl.partial new file mode 100755 index 0000000..2eb3279 --- /dev/null +++ b/docs/api/templates/partials/affix.tmpl.partial @@ -0,0 +1,40 @@ +{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} + + diff --git a/docs/api/templates/partials/footer.tmpl.partial b/docs/api/templates/partials/footer.tmpl.partial new file mode 100755 index 0000000..2de40a5 --- /dev/null +++ b/docs/api/templates/partials/footer.tmpl.partial @@ -0,0 +1,29 @@ +{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} + + \ No newline at end of file diff --git a/docs/api/templates/partials/head.tmpl.partial b/docs/api/templates/partials/head.tmpl.partial new file mode 100755 index 0000000..f9cdb7a --- /dev/null +++ b/docs/api/templates/partials/head.tmpl.partial @@ -0,0 +1,20 @@ +{{!Copyright (c) Oscar Vasquez. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} + + + + + {{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}} + + + + {{#_description}}{{/_description}} + + + + + + + {{#_noindex}}{{/_noindex}} + {{#_enableSearch}}{{/_enableSearch}} + {{#_enableNewTab}}{{/_enableNewTab}} + \ No newline at end of file diff --git a/docs/api/templates/styles/main.css b/docs/api/templates/styles/main.css new file mode 100755 index 0000000..fb07091 --- /dev/null +++ b/docs/api/templates/styles/main.css @@ -0,0 +1,466 @@ +:root, body.dark-theme { + --color-foreground: #ccd5dc; + --color-navbar: #66666d; + --color-breadcrumb: #999; + --color-underline: #ddd; + --color-toc-hover: #fff; + --color-background: #2d2d30; + --color-background-subnav: #333337; + --color-background-dark: #1e1e1e; + --color-background-table-alt: #212123; + --color-background-quote: #69696e; +} + +body.light-theme { + --color-foreground: #171717; + --color-breadcrumb: #4a4a4a; + --color-toc-hover: #4c4c4c; + --color-background: #ffffff; + --color-background-subnav: #f5f5f5; + --color-background-dark: #f5f5f5; + --color-background-table-alt: #f9f9f9; +} + +body { + color: var(--color-foreground); + line-height: 1.5; + font-size: 14px; + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; + word-wrap: break-word; + background-color: var(--color-background); +} + +.btn.focus, .btn:focus, .btn:hover { + color: var(--color-foreground); +} + +h1 { + font-weight: 600; + font-size: 32px; +} + +h2 { + font-weight: 600; + font-size: 24px; + line-height: 1.8; +} + +h3 { + font-weight: 600; + font-size: 20px; + line-height: 1.8; +} + +h5 { + font-size: 14px; + padding: 10px 0px; +} + +article h1, article h2, article h3, article h4 { + margin-top: 35px; + margin-bottom: 15px; +} + +article h4 { + padding-bottom: 8px; + border-bottom: 2px solid var(--color-underline); +} + +.navbar-brand>img { + color: var(--color-background); +} + +.navbar { + border: none; +} + +.subnav { + border-top: 1px solid var(--color-underline); + background-color: var(--color-background-subnav); +} + +.sidenav, .fixed_header, .toc { + background-color: var(--color-background); +} + +.navbar-inverse { + background-color: var(--color-background-dark); + z-index: 100; +} + +.navbar-inverse .navbar-nav>li>a, .navbar-inverse .navbar-text { + color: var(--color-navbar); + background-color: var(--color-background-dark); + border-bottom: 3px solid transparent; + padding-bottom: 12px; +} + +.navbar-inverse .navbar-nav>li>a:focus, .navbar-inverse .navbar-nav>li>a:hover { + color: var(--color-foreground); + background-color: var(--color-background-dark); + border-bottom: 3px solid var(--color-background-subnav); + transition: all ease 0.25s; +} + +.navbar-inverse .navbar-nav>.active>a, .navbar-inverse .navbar-nav>.active>a:focus, .navbar-inverse .navbar-nav>.active>a:hover { + color: var(--color-foreground); + background-color: var(--color-background-dark); + border-bottom: 3px solid var(--color-foreground); + transition: all ease 0.25s; +} + +.navbar-form .form-control { + border: none; + border-radius: 0; +} + +.light-theme .navbar-brand svg { + filter: brightness(20%); +} + +.toc .level1>li { + font-weight: 400; +} + +.toc .nav>li>a { + color: var(--color-foreground); +} + +.sidefilter { + background-color: var(--color-background); + border-left: none; + border-right: none; +} + +.sidefilter { + background-color: var(--color-background); + border-left: none; + border-right: none; +} + +.toc-filter { + padding: 10px; + margin: 0; + background-color: var(--color-background); +} + +.toc-filter>input { + border: none; + border-radius: unset; + background-color: var(--color-background-subnav); + padding: 5px 0 5px 20px; + font-size: 90% +} + +.toc-filter>.clear-icon { + position: absolute; + top: 17px; + right: 15px; +} + +.toc-filter>input:focus { + color: var(--color-foreground); + transition: all ease 0.25s; +} + +.toc-filter>.filter-icon { + display: none; +} + +.sidetoc>.toc { + background-color: var(--color-background); + overflow-x: hidden; +} + +.sidetoc { + background-color: var(--color-background); + border: none; +} + +.alert { + background-color: inherit; + border: none; + padding: 10px 0; + border-radius: 0; +} + +.alert>p { + margin-bottom: 0; + padding: 5px 10px; + border-bottom: 1px solid; + background-color: var(--color-background-dark); +} + +.alert>h5 { + padding: 10px 15px; + margin-top: 0; + margin-bottom: 0; + text-transform: uppercase; + font-weight: bold; + border-top: 2px solid; + background-color: var(--color-background-dark); + border-radius: none; +} + +.alert>ul { + margin-bottom: 0; + padding: 5px 40px; +} + +.alert-info { + color: #1976d2; +} + +.alert-warning { + color: #f57f17; +} + +.alert-danger { + color: #d32f2f; +} + +pre { + padding: 9.5px; + margin: 0 0 10px; + font-size: 13px; + word-break: break-all; + word-wrap: break-word; + background-color: var(--color-background-dark); + border-radius: 0; + border: none; +} + +code { + background: var(--color-background-dark) !important; + border-radius: 2px; +} + +.hljs { + color: var(--color-foreground); +} + +.toc .nav>li.active>.expand-stub::before, .toc .nav>li.in>.expand-stub::before, .toc .nav>li.in.active>.expand-stub::before, .toc .nav>li.filtered>.expand-stub::before { + content: "▾"; +} + +.toc .nav>li>.expand-stub::before, .toc .nav>li.active>.expand-stub::before { + content: "▸"; +} + +.affix ul ul>li>a:before { + content: "|"; +} + +.breadcrumb { + background-color: var(--color-background-subnav); +} + +.breadcrumb .label.label-primary { + background: #444; + border-radius: 0; + font-weight: normal; + font-size: 100%; +} + +#breadcrumb .breadcrumb>li a { + border-radius: 0; + font-weight: normal; + font-size: 85%; + display: inline; + padding: 0 .6em 0; + line-height: 1; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + color: var(--color-breadcrumb); +} + +#breadcrumb .breadcrumb>li a:hover { + color: var(--color-foreground); + transition: all ease 0.25s; +} + +.breadcrumb>li+li:before { + content: ">"; + font-size: 75%; + color: var(--color-foreground); + padding: 0; +} + +.toc .level1>li { + font-weight: 600; + font-size: 130%; + padding-left: 5px; +} + +.footer { + border-top: none; + background-color: var(--color-background-dark); + padding: 15px 0; + font-size: 90%; +} + +.toc .nav>li>a:hover, .toc .nav>li>a:focus { + color: var(--color-toc-hover); + transition: all ease 0.1s; +} + +.form-control { + background-color: var(--color-background-subnav); + border: none; + border-radius: 0; + -webkit-box-shadow: none; + box-shadow: none; +} + +.form-control:focus { + border-color: #66afe9; + outline: 0; + -webkit-box-shadow: none; + box-shadow: none; +} + +input#search-query:focus { + color: var(--color-foreground); +} + +.table-bordered, .table-bordered>tbody>tr>td, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>td, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>thead>tr>th { + border: 1px solid var(--color-background-dark); +} + +.table-striped>tbody>tr:nth-of-type(odd) { + background-color: var(--color-background-table-alt); +} + +blockquote { + padding: 10px 20px; + margin: 0 0 10px; + font-size: 110%; + border-left: 5px solid var(--color-background-quote); + color: var(--color-background-quote); +} + +.pagination>.disabled>a, .pagination>.disabled>a:focus, .pagination>.disabled>a:hover, .pagination>.disabled>span, .pagination>.disabled>span:focus, .pagination>.disabled>span:hover { + background-color: var(--color-background-subnav); + border-color: var(--color-background-subnav); +} + +.breadcrumb>li, .pagination { + display: inline; +} + +.tabGroup a[role="tab"] { + border-bottom: 2px solid var(--color-background-dark); +} + +.tabGroup a[role="tab"][aria-selected="true"] { + color: var(--color-foreground); +} + +.tabGroup section[role="tabpanel"] { + border: 1px solid var(--color-background-dark); +} + +.sideaffix > div.contribution > ul > li > a.contribution-link:hover { + background-color: var(--color-background); +} + +.switch { + position: relative; + display: inline-block; + width: 40px; + height: 20px; +} + +.switch input { + opacity: 0; + width: 0; + height: 0; +} + +.slider { + position: absolute; + cursor: pointer; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: #ccc; + -webkit-transition: .4s; + transition: .4s; +} + +.slider:before { + position: absolute; + content: ""; + height: 14px; + width: 14px; + left: 4px; + bottom: 3px; + background-color: white; + -webkit-transition: .4s; + transition: .4s; +} + +input:checked + .slider { + background-color: #337ab7; +} + +input:focus + .slider { + box-shadow: 0 0 1px #337ab7; +} + +input:checked + .slider:before { + -webkit-transform: translateX(19px); + -ms-transform: translateX(19px); + transform: translateX(19px); +} + +/* Rounded sliders */ +.slider.round { + border-radius: 20px; +} + +.slider.round:before { + border-radius: 50%; +} +.toggle-mode .icon { + display: inline-block; +} + +.toggle-mode .icon i { + font-style: normal; + font-size: 17px; + display: inline-block; + padding-right: 7px; + padding-left: 7px; + vertical-align: middle; +} + +@media (min-width: 1600px) { + .container { + width: 100%; + } + .sidefilter { + width: 18%; + } + .sidetoc { + width: 18%; + } + .article.grid-right { + margin-left: 19%; + } + .sideaffix { + width: 11.5%; + } + .affix ul>li.active>a { + white-space: initial; + } + .affix ul>li>a { + width: 99%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } +} \ No newline at end of file diff --git a/docs/api/templates/styles/toggle-theme.js b/docs/api/templates/styles/toggle-theme.js new file mode 100755 index 0000000..f1b3809 --- /dev/null +++ b/docs/api/templates/styles/toggle-theme.js @@ -0,0 +1,35 @@ +const sw = document.getElementById("switch-style"), sw_mobile = document.getElementById("switch-style-m"), b = document.body; +if (b) { + function toggleTheme(target, dark) { + target.classList.toggle("dark-theme", dark) + target.classList.toggle("light-theme", !dark) + } + + function switchEventListener() { + toggleTheme(b, this.checked); + if (window.localStorage) { + this.checked ? localStorage.setItem("theme", "dark-theme") : localStorage.setItem("theme", "light-theme") + } + } + + var isDarkTheme = !window.localStorage || !window.localStorage.getItem("theme") || window.localStorage && localStorage.getItem("theme") === "dark-theme"; + + if(sw && sw_mobile){ + sw.checked = isDarkTheme; + sw_mobile.checked = isDarkTheme; + + sw.addEventListener("change", switchEventListener); + sw_mobile.addEventListener("change", switchEventListener); + + // sync state between switches + sw.addEventListener("change", function() { + sw_mobile.checked = this.checked; + }); + + sw_mobile.addEventListener("change", function() { + sw.checked = this.checked; + }); + } + + toggleTheme(b, isDarkTheme); +} \ No newline at end of file diff --git a/docs/api/toc.yml b/docs/api/toc.yml new file mode 100644 index 0000000..f5aadfa --- /dev/null +++ b/docs/api/toc.yml @@ -0,0 +1,3 @@ +- name: API Reference + href: reference/ + homepage: reference/index.md diff --git a/docs/index.md b/docs/index.md index 07cd9e0..b7b03c7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,7 +4,7 @@ title: About nav_order: 1 --- -# Reddit .NET Client +# Reddit.NET A .NET client for interacting with [reddit](https://www.reddit.com). diff --git a/src/Reddit.NET.Client/Authentication/Abstract/AuthenticationContext.cs b/src/Reddit.NET.Client/Authentication/Abstract/AuthenticationContext.cs index 0771b17..d50f00b 100644 --- a/src/Reddit.NET.Client/Authentication/Abstract/AuthenticationContext.cs +++ b/src/Reddit.NET.Client/Authentication/Abstract/AuthenticationContext.cs @@ -8,7 +8,7 @@ namespace Reddit.NET.Client.Authentication.Abstract { /// - /// Represents a context which can be used when performing operations that require authentication. + /// Represents a context for performing operations that require authentication. /// public abstract class AuthenticationContext { diff --git a/src/Reddit.NET.Client/Authentication/Credential/Credentials.cs b/src/Reddit.NET.Client/Authentication/Credential/Credentials.cs index 0f413ec..76b3d5a 100644 --- a/src/Reddit.NET.Client/Authentication/Credential/Credentials.cs +++ b/src/Reddit.NET.Client/Authentication/Credential/Credentials.cs @@ -4,7 +4,7 @@ namespace Reddit.NET.Client.Authentication.Credential { /// - /// Encapsulates the available details used during authentication with reddit. + /// Encapsulates the details available for authentication with reddit. /// public abstract class Credentials { diff --git a/src/Reddit.NET.Client/Authentication/Credential/InteractiveCredentials.cs b/src/Reddit.NET.Client/Authentication/Credential/InteractiveCredentials.cs index 8bf6c65..e90901f 100644 --- a/src/Reddit.NET.Client/Authentication/Credential/InteractiveCredentials.cs +++ b/src/Reddit.NET.Client/Authentication/Credential/InteractiveCredentials.cs @@ -13,6 +13,9 @@ namespace Reddit.NET.Client.Authentication.Credential /// /// A implementation used for interactive authentication. /// + /// + /// Interactive authentication requires a user to perform actions to complete the authentication. + /// public sealed class InteractiveCredentials : Credentials { /// diff --git a/src/Reddit.NET.Client/Command/CommandExecutor.cs b/src/Reddit.NET.Client/Command/CommandExecutor.cs index 50b0c33..ff9cd64 100644 --- a/src/Reddit.NET.Client/Command/CommandExecutor.cs +++ b/src/Reddit.NET.Client/Command/CommandExecutor.cs @@ -32,7 +32,7 @@ namespace Reddit.NET.Client.Command /// Requests that result in transient HTTP response status codes will be retried a number of times, with an exponential back-off sleep duration. /// /// - /// To remain within the reddit API rate limits, command execution will be managed to ensure that the number of requests being ,ade + /// To remain within the reddit API rate limits, command execution will be managed to ensure that the number of requests being made /// falls within the rate limits imposed. /// /// diff --git a/src/Reddit.NET.Client/Models/Internal/Base/Error.cs b/src/Reddit.NET.Client/Models/Internal/Base/Error.cs index 27e448a..d92b9b4 100644 --- a/src/Reddit.NET.Client/Models/Internal/Base/Error.cs +++ b/src/Reddit.NET.Client/Models/Internal/Base/Error.cs @@ -7,7 +7,7 @@ namespace Reddit.NET.Client.Models.Internal.Base /// Defines the attributes of a reddit API error object. /// /// - /// + /// /// { /// "fields": [ /// "name" diff --git a/src/Reddit.NET.Client/Models/Internal/Base/JsonDataResponse.cs b/src/Reddit.NET.Client/Models/Internal/Base/JsonDataResponse.cs index 199d9bc..594faa1 100644 --- a/src/Reddit.NET.Client/Models/Internal/Base/JsonDataResponse.cs +++ b/src/Reddit.NET.Client/Models/Internal/Base/JsonDataResponse.cs @@ -51,7 +51,7 @@ internal class JsonNode /// /// /// An example of the data returned by the subreddit submission endpoint: - /// + /// /// { /// "json": { /// "errors": [], @@ -94,7 +94,7 @@ internal class CreateSubmissionDataNode /// /// /// An example of the data returned by the subreddit submission endpoint: - /// + /// /// { /// "json": { /// "errors" : [], diff --git a/src/Reddit.NET.Client/Models/Public/Read/CommentThreadNavigator.cs b/src/Reddit.NET.Client/Models/Public/Read/CommentThreadNavigator.cs index 3a03aa0..0a054da 100644 --- a/src/Reddit.NET.Client/Models/Public/Read/CommentThreadNavigator.cs +++ b/src/Reddit.NET.Client/Models/Public/Read/CommentThreadNavigator.cs @@ -25,7 +25,7 @@ namespace Reddit.NET.Client.Models.Public.Read /// /// /// Note that the replies in a thread can be directly enumerated over, as below: - /// + /// /// CommentThreadNavigator navigator = ...; /// /// foreach (CommentThread topLevelThread in navigator) diff --git a/src/Reddit.NET.Client/RedditClient.cs b/src/Reddit.NET.Client/RedditClient.cs index 6e6f537..b960fb2 100644 --- a/src/Reddit.NET.Client/RedditClient.cs +++ b/src/Reddit.NET.Client/RedditClient.cs @@ -31,8 +31,8 @@ namespace Reddit.NET.Client /// /// /// An example of interacting with a specific subreddit: - /// - /// Interact with a subreddit + /// + /// // Interact with a subreddit /// SubredditInteractor askReddit = client.Subreddit("askreddit"); /// /// SubredditDetails askRedditDetails = await askReddit.GetDetailsAsync();