├── .gitattributes ├── .gitignore ├── LICENSE ├── README.ja.md ├── README.md ├── TootNet.Demo ├── Program.cs └── TootNet.Demo.csproj ├── TootNet.Generator ├── .gitignore ├── api_templates │ ├── accounts.json │ ├── announcements.json │ ├── apps.json │ ├── blocks.json │ ├── bookmarks.json │ ├── conversations.json │ ├── custom_emojis.json │ ├── directory.json │ ├── domain_blocks.json │ ├── endorsements.json │ ├── favourites.json │ ├── featured_tags.json │ ├── filters.json │ ├── follow_requests.json │ ├── grouped_notifications.json │ ├── instance.json │ ├── lists.json │ ├── markers.json │ ├── media.json │ ├── mutes.json │ ├── notifications.json │ ├── oembed.json │ ├── polls.json │ ├── preferences.json │ ├── profile.json │ ├── reports.json │ ├── scheduled_statuses.json │ ├── search.json │ ├── statuses.json │ ├── suggestions.json │ ├── tags.json │ ├── timelines.json │ └── trends.json ├── mastodon_docs │ └── .keep ├── poetry.lock ├── pyproject.toml └── src │ └── tootnet │ ├── __init__.py │ ├── generate_cs_code.py │ ├── generate_template.py │ └── main.py ├── TootNet.Tests ├── AccountInformation.cs.example ├── AccountsTests.cs ├── AnnouncementsTests.cs ├── AppsTests.cs ├── BlocksTests.cs ├── BookmarksTests.cs ├── ConversationsTests.cs ├── CustomEmojisTests.cs ├── Data │ └── image.png ├── DirectoryTests.cs ├── DomainBlocksTests.cs ├── EndorsementsTests.cs ├── FavouritesTests.cs ├── FeaturedTagsTests.cs ├── FiltersTests.cs ├── FollowRequestsTests.cs ├── GroupedNotificationsTests.cs ├── InstancesTests.cs ├── ListsTests.cs ├── MarkersTests.cs ├── MediaTests.cs ├── MutesTests.cs ├── NotificationsTests.cs ├── OEmbedTests.cs ├── PollTests.cs ├── PreferencesTests.cs ├── ProfileTests.cs ├── ReportsTests.cs ├── ScheduledStatusesTests.cs ├── SearchTests.cs ├── StatusesTests.cs ├── SuggestionsTests.cs ├── TagsTests.cs ├── TimelinesTests.cs ├── TootNet.Tests.csproj └── TrendsTests.cs ├── TootNet.sln └── TootNet ├── Authorize.cs ├── Connection.cs ├── Exception └── MastodonException.cs ├── Internal ├── ApiBase.cs ├── Converter.cs ├── JsonConverter.cs ├── Request.cs ├── TokensBase.cs └── Utils.cs ├── Objects ├── Account.cs ├── Activity.cs ├── Announcement.cs ├── Application.cs ├── Base.cs ├── Context.cs ├── Conversation.cs ├── CredentialAccount.cs ├── CustomEmoji.cs ├── DomainBlock.cs ├── Error.cs ├── ExtendedDescription.cs ├── FamiliarFollower.cs ├── FeaturedTag.cs ├── Filter.cs ├── FilterKeyword.cs ├── FilterResult.cs ├── FilterStatus.cs ├── GroupedNotificationsResults.cs ├── Instance.cs ├── List.cs ├── Marker.cs ├── MediaAttachment.cs ├── Notification.cs ├── NotificationPolicy.cs ├── NotificationRequest.cs ├── OEmbed.cs ├── Poll.cs ├── PreviewCard.cs ├── Reaction.cs ├── Relationship.cs ├── Report.cs ├── Role.cs ├── Rule.cs ├── ScheduledStatus.cs ├── Search.cs ├── Status.cs ├── StatusEdit.cs ├── StatusSource.cs ├── Suggestion.cs ├── Tag.cs ├── Token.cs ├── Translation.cs └── TrendsLink.cs ├── Rest ├── Accounts.cs ├── Announcements.cs ├── Apps.cs ├── Blocks.cs ├── Bookmarks.cs ├── Conversations.cs ├── CustomEmojis.cs ├── Directory.cs ├── DomainBlocks.cs ├── Endorsements.cs ├── Favourites.cs ├── FeaturedTags.cs ├── Filters.cs ├── FollowRequests.cs ├── GroupedNotifications.cs ├── Instance.cs ├── Lists.cs ├── Markers.cs ├── Media.cs ├── Mutes.cs ├── Notifications.cs ├── OEmbed.cs ├── Polls.cs ├── Preferences.cs ├── Profile.cs ├── Reports.cs ├── ScheduledStatuses.cs ├── Search.cs ├── Statuses.cs ├── Suggestions.cs ├── Tags.cs ├── Timelines.cs └── Trends.cs ├── Streaming ├── Streaming.cs ├── StreamingMessage.cs ├── StreamingType.cs └── WebSocketStreaming.cs ├── Tokens.cs └── TootNet.csproj /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017-2024 cucmberium 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.ja.md: -------------------------------------------------------------------------------- 1 | # TootNet 2 | 3 | [![NuGetBadge](https://img.shields.io/nuget/v/TootNet.svg)](https://www.nuget.org/packages/TootNet) 4 | 5 | TootNet は.NET Standard向けのマストドンライブラリです。 6 | 7 | このライブラリはTwitterライブラリの[CoreTweet](https://github.com/CoreTweet/CoreTweet)と同じように直感的にAPIにアクセスできるように設計されています。 8 | 9 | ### Sample 10 | 11 | 基本的な使い方は[Demo](https://github.com/cucmberium/TootNet/tree/master/TootNet.Demo)をご覧ください。 12 | 13 | また、[テストコード](https://github.com/cucmberium/TootNet/tree/master/TootNet.Tests)には、すべてのAPIの簡易的な使い方が学べます。 14 | 15 | TootNetではほぼ公式APIと対応がとれているため[こちら](https://docs.joinmastodon.org/api/)の公式ドキュメントも同様に参考になります。 16 | 17 | 認証: 18 | ```cs 19 | // Create new app 20 | var authorize = new Authorize(); 21 | await authorize.CreateApp("mstdn.jp", "yourclientnamehere", Scope.Read | Scope.Write); 22 | 23 | // Authorize with code 24 | var authorizeUrl = authorize.GetAuthorizeUri(); 25 | Console.WriteLine(authorizeUrl); 26 | var code = Console.ReadLine().Trim(); 27 | var tokens = await authorize.AuthorizeWithCode(code); 28 | ``` 29 | 30 | トゥート: 31 | ```cs 32 | using (var fs = new FileStream(@"./picture.png", FileMode.Open, FileAccess.Read)) 33 | { 34 | // toot with picture 35 | var attachment = await tokens.MediaAttachments.PostAsync(file => fs); 36 | await tokens.Statuses.PostAsync(status => "test toot", visibility => "private", media_ids => new List() { attachment.Id }); 37 | } 38 | ``` 39 | 40 | タイムラインの取得: 41 | ```cs 42 | var statuses = await tokens.Timelines.HomeAsync(limit => 10); 43 | 44 | foreach (var status in statuses) 45 | Console.WriteLine(status.Content); 46 | ``` 47 | 48 | 49 | ReactiveExtensionsを用いたストリーミング: 50 | ```cs 51 | var observable = tokens.Streaming.UserAsObservable(); 52 | var disposable = observable.Subscribe(x => 53 | { 54 | switch (x.Type) 55 | { 56 | case StreamingMessage.MessageType.Status: 57 | Console.WriteLine(x.Status.Account.Acct + x.Status.Content); 58 | break; 59 | } 60 | }); 61 | 62 | await Task.Delay(TimeSpan.FromSeconds(30)); 63 | disposable.Dispose(); 64 | ``` 65 | 66 | ### Platforms 67 | 68 | * .NET Standard 69 | 70 | ### License 71 | 72 | This software is licensed under the MIT License. 73 | 74 | このライブラリでは以下のライブラリの一部のコードを使用しています。 75 | * [Mastonet](https://github.com/glacasa/Mastonet) 76 | * [CoreTweet](https://github.com/CoreTweet/CoreTweet) 77 | 78 | ### Other 79 | 80 | プルリクエストはいつでも歓迎です! 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TootNet 2 | 3 | [![NuGetBadge](https://img.shields.io/nuget/v/TootNet.svg)](https://www.nuget.org/packages/TootNet) 4 | 5 | 日本語のREADMEは[こちら](https://github.com/cucmberium/TootNet/tree/master/README.ja.md) 6 | 7 | TootNet is a Mastodon library for .NET Standard. 8 | 9 | This library is designed to intuitively access the API in the same way as the Twitter library [CoreTweet](https://github.com/CoreTweet/CoreTweet). 10 | 11 | ### Sample 12 | 13 | For basic usage, please refer to the [Demo](https://github.com/cucmberium/TootNet/tree/master/TootNet.Demo). 14 | 15 | Also, the [test code](https://github.com/cucmberium/TootNet/tree/master/TootNet.Tests) provides simple usage for all APIs. 16 | 17 | Since TootNet is almost compatible with the official API, the [official documentation](https://docs.joinmastodon.org/api/) is also a useful reference. 18 | 19 | Authorizing: 20 | ```cs 21 | // Create new app 22 | var authorize = new Authorize(); 23 | await authorize.CreateApp("mstdn.jp", "yourclientnamehere", Scope.Read | Scope.Write); 24 | 25 | // Authorize with code 26 | var authorizeUrl = authorize.GetAuthorizeUri(); 27 | Console.WriteLine(authorizeUrl); 28 | var code = Console.ReadLine().Trim(); 29 | var tokens = await authorize.AuthorizeWithCode(code); 30 | ``` 31 | 32 | Tooting: 33 | ```cs 34 | using (var fs = new FileStream(@"./picture.png", FileMode.Open, FileAccess.Read)) 35 | { 36 | // toot with picture 37 | var attachment = await tokens.MediaAttachments.PostAsync(file => fs); 38 | await tokens.Statuses.PostAsync(status => "test toot", visibility => "private", media_ids => new List() { attachment.Id }); 39 | } 40 | ``` 41 | 42 | Getting timelines: 43 | ```cs 44 | var statuses = await tokens.Timelines.HomeAsync(limit => 10); 45 | 46 | foreach (var status in statuses) 47 | Console.WriteLine(status.Content); 48 | ``` 49 | 50 | 51 | Streaming using reactive extensions: 52 | ```cs 53 | var observable = tokens.Streaming.UserAsObservable(); 54 | var disposable = observable.Subscribe(x => 55 | { 56 | switch (x.Type) 57 | { 58 | case StreamingMessage.MessageType.Status: 59 | Console.WriteLine(x.Status.Account.Acct + x.Status.Content); 60 | break; 61 | } 62 | }); 63 | 64 | await Task.Delay(TimeSpan.FromSeconds(30)); 65 | disposable.Dispose(); 66 | ``` 67 | 68 | ### Platforms 69 | 70 | * .NET Standard 71 | 72 | ### License 73 | 74 | This software is licensed under the MIT License. 75 | 76 | This library uses part of the codes of the following libraries. 77 | * [Mastonet](https://github.com/glacasa/Mastonet) 78 | * [CoreTweet](https://github.com/CoreTweet/CoreTweet) 79 | 80 | ### Other 81 | 82 | Pull requests are welcome! 83 | -------------------------------------------------------------------------------- /TootNet.Demo/TootNet.Demo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /TootNet.Generator/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm.fming.dev/#use-with-ide 110 | .pdm.toml 111 | 112 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 113 | __pypackages__/ 114 | 115 | # Celery stuff 116 | celerybeat-schedule 117 | celerybeat.pid 118 | 119 | # SageMath parsed files 120 | *.sage.py 121 | 122 | # Environments 123 | .env 124 | .venv 125 | env/ 126 | venv/ 127 | ENV/ 128 | env.bak/ 129 | venv.bak/ 130 | 131 | # Spyder project settings 132 | .spyderproject 133 | .spyproject 134 | 135 | # Rope project settings 136 | .ropeproject 137 | 138 | # mkdocs documentation 139 | /site 140 | 141 | # mypy 142 | .mypy_cache/ 143 | .dmypy.json 144 | dmypy.json 145 | 146 | # Pyre type checker 147 | .pyre/ 148 | 149 | # pytype static type analyzer 150 | .pytype/ 151 | 152 | # Cython debug symbols 153 | cython_debug/ 154 | 155 | # PyCharm 156 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 157 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 158 | # and can be added to the global gitignore or merged into this file. For a more nuclear 159 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 160 | .idea/ 161 | 162 | # Custom 163 | mastodon_docs/* 164 | !.keep 165 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/announcements.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/announcements", 4 | "method": "GET", 5 | "description": "View all announcements", 6 | "return": "Array Announcement", 7 | "parameters": [] 8 | }, 9 | { 10 | "path": "/api/v1/announcements/:id/dismiss", 11 | "method": "POST", 12 | "description": "Dismiss an announcement", 13 | "return": "Empty", 14 | "parameters": [ 15 | { 16 | "name": ":id", 17 | "type": "String", 18 | "required": true 19 | } 20 | ] 21 | }, 22 | { 23 | "path": "/api/v1/announcements/:id/reactions/:name", 24 | "name": "PutReaction", 25 | "method": "PUT", 26 | "description": "Add a reaction to an announcement", 27 | "return": "Empty", 28 | "parameters": [ 29 | { 30 | "name": ":id", 31 | "type": "String", 32 | "required": true 33 | }, 34 | { 35 | "name": ":name", 36 | "type": "String", 37 | "required": true 38 | } 39 | ] 40 | }, 41 | { 42 | "path": "/api/v1/announcements/:id/reactions/:name", 43 | "name": "DeleteReaction", 44 | "method": "DELETE", 45 | "description": "Remove a reaction from an announcement", 46 | "return": "Empty", 47 | "parameters": [ 48 | { 49 | "name": ":id", 50 | "type": "String", 51 | "required": true 52 | }, 53 | { 54 | "name": ":name", 55 | "type": "String", 56 | "required": true 57 | } 58 | ] 59 | } 60 | ] 61 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/apps.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/apps/verify_credentials", 4 | "method": "GET", 5 | "description": "Verify your app works", 6 | "return": "Application", 7 | "parameters": [] 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/blocks.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/blocks", 4 | "method": "GET", 5 | "description": "View blocked users", 6 | "return": "Array Account", 7 | "parameters": [ 8 | { 9 | "name": "max_id", 10 | "type": "Integer", 11 | "required": false 12 | }, 13 | { 14 | "name": "since_id", 15 | "type": "Integer", 16 | "required": false 17 | }, 18 | { 19 | "name": "min_id", 20 | "type": "Integer", 21 | "required": false 22 | }, 23 | { 24 | "name": "limit", 25 | "type": "Integer", 26 | "required": false 27 | } 28 | ] 29 | }, 30 | { 31 | "path": "/api/v1/accounts/:id/block", 32 | "method": "POST", 33 | "description": "Block account", 34 | "return": "Relationship", 35 | "parameters": [ 36 | { 37 | "name": ":id", 38 | "type": "String", 39 | "required": true 40 | } 41 | ] 42 | }, 43 | { 44 | "path": "/api/v1/accounts/:id/unblock", 45 | "method": "POST", 46 | "description": "Unblock account", 47 | "return": "Relationship", 48 | "parameters": [ 49 | { 50 | "name": ":id", 51 | "type": "String", 52 | "required": true 53 | } 54 | ] 55 | } 56 | ] 57 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/bookmarks.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/bookmarks", 4 | "method": "GET", 5 | "description": "View bookmarked statuses", 6 | "return": "Array Status", 7 | "parameters": [ 8 | { 9 | "name": "max_id", 10 | "type": "Integer", 11 | "required": false 12 | }, 13 | { 14 | "name": "since_id", 15 | "type": "Integer", 16 | "required": false 17 | }, 18 | { 19 | "name": "min_id", 20 | "type": "Integer", 21 | "required": false 22 | }, 23 | { 24 | "name": "limit", 25 | "type": "Integer", 26 | "required": false 27 | } 28 | ] 29 | }, 30 | { 31 | "path": "/api/v1/statuses/:id/bookmark", 32 | "method": "POST", 33 | "description": "Bookmark a status", 34 | "return": "Status", 35 | "parameters": [ 36 | { 37 | "name": ":id", 38 | "type": "String", 39 | "required": true 40 | } 41 | ] 42 | }, 43 | { 44 | "path": "/api/v1/statuses/:id/unbookmark", 45 | "method": "POST", 46 | "description": "Undo bookmark of a status", 47 | "return": "Status", 48 | "parameters": [ 49 | { 50 | "name": ":id", 51 | "type": "String", 52 | "required": true 53 | } 54 | ] 55 | } 56 | ] 57 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/conversations.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/conversations", 4 | "method": "GET", 5 | "description": "View all conversations", 6 | "return": "Array Conversation", 7 | "parameters": [ 8 | { 9 | "name": "max_id", 10 | "type": "Integer", 11 | "required": false 12 | }, 13 | { 14 | "name": "since_id", 15 | "type": "Integer", 16 | "required": false 17 | }, 18 | { 19 | "name": "min_id", 20 | "type": "Integer", 21 | "required": false 22 | }, 23 | { 24 | "name": "limit", 25 | "type": "Integer", 26 | "required": false 27 | } 28 | ] 29 | }, 30 | { 31 | "path": "/api/v1/conversations/:id", 32 | "method": "DELETE", 33 | "description": "Remove a conversation", 34 | "return": "Empty", 35 | "parameters": [ 36 | { 37 | "name": ":id", 38 | "type": "String", 39 | "required": true 40 | } 41 | ] 42 | }, 43 | { 44 | "path": "/api/v1/conversations/:id/read", 45 | "method": "POST", 46 | "description": "Mark a conversation as read", 47 | "return": "Conversation", 48 | "parameters": [ 49 | { 50 | "name": ":id", 51 | "type": "String", 52 | "required": true 53 | } 54 | ] 55 | } 56 | ] 57 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/custom_emojis.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/custom_emojis", 4 | "method": "GET", 5 | "description": "View all custom emoji", 6 | "return": "Array CustomEmoji", 7 | "parameters": [] 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/directory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/directory", 4 | "method": "GET", 5 | "description": "View profile directory", 6 | "return": "Array Account", 7 | "parameters": [ 8 | { 9 | "name": "offset", 10 | "type": "Number", 11 | "required": false 12 | }, 13 | { 14 | "name": "limit", 15 | "type": "Number", 16 | "required": false 17 | }, 18 | { 19 | "name": "order", 20 | "type": "String", 21 | "required": false 22 | }, 23 | { 24 | "name": "local", 25 | "type": "Boolean", 26 | "required": false 27 | } 28 | ] 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/domain_blocks.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/domain_blocks", 4 | "method": "GET", 5 | "description": "Get domain blocks", 6 | "return": "Array String", 7 | "parameters": [ 8 | { 9 | "name": "max_id", 10 | "type": "Integer", 11 | "required": false 12 | }, 13 | { 14 | "name": "since_id", 15 | "type": "Integer", 16 | "required": false 17 | }, 18 | { 19 | "name": "min_id", 20 | "type": "Integer", 21 | "required": false 22 | }, 23 | { 24 | "name": "limit", 25 | "type": "Integer", 26 | "required": false 27 | } 28 | ] 29 | }, 30 | { 31 | "path": "/api/v1/domain_blocks", 32 | "method": "POST", 33 | "description": "Block a domain", 34 | "return": "Empty", 35 | "parameters": [ 36 | { 37 | "name": "domain", 38 | "type": "String", 39 | "required": true 40 | } 41 | ] 42 | }, 43 | { 44 | "path": "/api/v1/domain_blocks", 45 | "method": "DELETE", 46 | "description": "Unblock a domain", 47 | "return": "Empty", 48 | "parameters": [ 49 | { 50 | "name": "domain", 51 | "type": "String", 52 | "required": true 53 | } 54 | ] 55 | } 56 | ] 57 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/endorsements.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/endorsements", 4 | "method": "GET", 5 | "description": "View currently featured profiles", 6 | "return": "Array Account", 7 | "parameters": [ 8 | { 9 | "name": "max_id", 10 | "type": "Integer", 11 | "required": false 12 | }, 13 | { 14 | "name": "since_id", 15 | "type": "Integer", 16 | "required": false 17 | }, 18 | { 19 | "name": "limit", 20 | "type": "Integer", 21 | "required": false 22 | } 23 | ] 24 | }, 25 | { 26 | "path": "/api/v1/accounts/:id/pin", 27 | "method": "POST", 28 | "description": "Feature account on your profile", 29 | "return": "Relationship", 30 | "parameters": [ 31 | { 32 | "name": ":id", 33 | "type": "String", 34 | "required": true 35 | } 36 | ] 37 | }, 38 | { 39 | "path": "/api/v1/accounts/:id/unpin", 40 | "method": "POST", 41 | "description": "Unfeature account from profile", 42 | "return": "Relationship", 43 | "parameters": [ 44 | { 45 | "name": ":id", 46 | "type": "String", 47 | "required": true 48 | } 49 | ] 50 | } 51 | ] 52 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/favourites.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/favourites", 4 | "method": "GET", 5 | "description": "View favourited statuses", 6 | "return": "Array Status", 7 | "parameters": [ 8 | { 9 | "name": "max_id", 10 | "type": "Integer", 11 | "required": false 12 | }, 13 | { 14 | "name": "since_id", 15 | "type": "Integer", 16 | "required": false 17 | }, 18 | { 19 | "name": "min_id", 20 | "type": "Integer", 21 | "required": false 22 | }, 23 | { 24 | "name": "limit", 25 | "type": "Integer", 26 | "required": false 27 | } 28 | ] 29 | }, 30 | { 31 | "path": "/api/v1/statuses/:id/favourite", 32 | "method": "POST", 33 | "description": "Favourite a status", 34 | "return": "Status", 35 | "parameters": [ 36 | { 37 | "name": ":id", 38 | "type": "String", 39 | "required": true 40 | } 41 | ] 42 | }, 43 | { 44 | "path": "/api/v1/statuses/:id/unfavourite", 45 | "method": "POST", 46 | "description": "Undo favourite of a status", 47 | "return": "Status", 48 | "parameters": [ 49 | { 50 | "name": ":id", 51 | "type": "String", 52 | "required": true 53 | } 54 | ] 55 | } 56 | ] 57 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/featured_tags.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/featured_tags", 4 | "method": "GET", 5 | "description": "View your featured tags", 6 | "return": "Array FeaturedTag", 7 | "parameters": [] 8 | }, 9 | { 10 | "path": "/api/v1/featured_tags", 11 | "method": "POST", 12 | "description": "Feature a tag", 13 | "return": "FeaturedTag", 14 | "parameters": [ 15 | { 16 | "name": "name", 17 | "type": "String", 18 | "required": true 19 | } 20 | ] 21 | }, 22 | { 23 | "path": "/api/v1/featured_tags/:id", 24 | "method": "DELETE", 25 | "description": "Unfeature a tag", 26 | "return": "Empty", 27 | "parameters": [ 28 | { 29 | "name": ":id", 30 | "type": "String", 31 | "required": true 32 | } 33 | ] 34 | }, 35 | { 36 | "path": "/api/v1/featured_tags/suggestions", 37 | "method": "GET", 38 | "description": "View suggested tags to feature", 39 | "return": "Array Tag", 40 | "parameters": [] 41 | } 42 | ] 43 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/follow_requests.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/follow_requests", 4 | "method": "GET", 5 | "description": "View pending follow requests", 6 | "return": "Array Account", 7 | "parameters": [ 8 | { 9 | "name": "max_id", 10 | "type": "Integer", 11 | "required": false 12 | }, 13 | { 14 | "name": "since_id", 15 | "type": "Integer", 16 | "required": false 17 | }, 18 | { 19 | "name": "limit", 20 | "type": "Integer", 21 | "required": false 22 | } 23 | ] 24 | }, 25 | { 26 | "path": "/api/v1/follow_requests/:account_id/authorize", 27 | "method": "POST", 28 | "description": "Accept follow request", 29 | "return": "Relationship", 30 | "parameters": [ 31 | { 32 | "name": ":account_id", 33 | "type": "String", 34 | "required": true 35 | } 36 | ] 37 | }, 38 | { 39 | "path": "/api/v1/follow_requests/:account_id/reject", 40 | "method": "POST", 41 | "description": "Reject follow request", 42 | "return": "Relationship", 43 | "parameters": [ 44 | { 45 | "name": ":account_id", 46 | "type": "String", 47 | "required": true 48 | } 49 | ] 50 | } 51 | ] 52 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/instance.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v2/instance", 4 | "method": "GET", 5 | "description": "View server information", 6 | "return": "Instance", 7 | "parameters": [] 8 | }, 9 | { 10 | "path": "/api/v1/instance/peers", 11 | "method": "GET", 12 | "description": "List of connected domains", 13 | "return": "Array String", 14 | "parameters": [] 15 | }, 16 | { 17 | "path": "/api/v1/instance/activity", 18 | "method": "GET", 19 | "description": "Weekly activity", 20 | "return": "Array Activity", 21 | "parameters": [] 22 | }, 23 | { 24 | "path": "/api/v1/instance/rules", 25 | "method": "GET", 26 | "description": "List of rules", 27 | "return": "Array Rule", 28 | "parameters": [] 29 | }, 30 | { 31 | "path": "/api/v1/instance/domain_blocks", 32 | "method": "GET", 33 | "description": "View moderated servers", 34 | "return": "Array DomainBlock", 35 | "parameters": [] 36 | }, 37 | { 38 | "path": "/api/v1/instance/extended_description", 39 | "method": "GET", 40 | "description": "View extended description", 41 | "return": "ExtendedDescription", 42 | "parameters": [] 43 | }, 44 | { 45 | "path": "/api/v1/instance/translation_languages", 46 | "method": "GET", 47 | "description": "View translation languages", 48 | "return": "Dict String,(Array String)", 49 | "parameters": [] 50 | } 51 | ] 52 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/markers.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/markers", 4 | "method": "GET", 5 | "description": "Get saved timeline positions", 6 | "return": "Dict String,Marker", 7 | "parameters": [ 8 | { 9 | "name": "timeline", 10 | "note": "allowed values: \"home\", \"notifications\"", 11 | "type": "Array String", 12 | "required": false 13 | } 14 | ] 15 | }, 16 | { 17 | "path": "/api/v1/markers", 18 | "method": "POST", 19 | "description": "Save your position in a timeline", 20 | "return": "Dict String,Marker", 21 | "parameters": [ 22 | { 23 | "name": "home[last_read_id]", 24 | "type": "String", 25 | "required": false 26 | }, 27 | { 28 | "name": "notifications[last_read_id]", 29 | "type": "String", 30 | "required": false 31 | } 32 | ] 33 | } 34 | ] 35 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/media.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v2/media", 4 | "method": "POST", 5 | "description": "Upload media as an attachment (async)", 6 | "return": "MediaAttachment", 7 | "parameters": [ 8 | { 9 | "name": "file", 10 | "type": "Object", 11 | "required": true 12 | }, 13 | { 14 | "name": "thumbnail", 15 | "type": "Object", 16 | "required": false 17 | }, 18 | { 19 | "name": "description", 20 | "type": "String", 21 | "required": false 22 | }, 23 | { 24 | "name": "focus", 25 | "type": "String", 26 | "required": false 27 | } 28 | ] 29 | }, 30 | { 31 | "path": "/api/v1/media/:id", 32 | "method": "GET", 33 | "description": "Get media attachment", 34 | "return": "MediaAttachment", 35 | "parameters": [ 36 | { 37 | "name": ":id", 38 | "type": "String", 39 | "required": true 40 | } 41 | ] 42 | }, 43 | { 44 | "path": "/api/v1/media/:id", 45 | "method": "PUT", 46 | "description": "Update media attachment", 47 | "return": "MediaAttachment", 48 | "parameters": [ 49 | { 50 | "name": ":id", 51 | "type": "String", 52 | "required": true 53 | }, 54 | { 55 | "name": "thumbnail", 56 | "type": "Object", 57 | "required": false 58 | }, 59 | { 60 | "name": "description", 61 | "type": "String", 62 | "required": false 63 | }, 64 | { 65 | "name": "focus", 66 | "note": "focal point: two floating points, comma-delimited", 67 | "type": "String", 68 | "required": false 69 | } 70 | ] 71 | } 72 | ] 73 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/mutes.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/mutes", 4 | "method": "GET", 5 | "description": "View muted accounts", 6 | "return": "Array Account", 7 | "parameters": [ 8 | { 9 | "name": "max_id", 10 | "type": "Integer", 11 | "required": false 12 | }, 13 | { 14 | "name": "since_id", 15 | "type": "Integer", 16 | "required": false 17 | }, 18 | { 19 | "name": "limit", 20 | "type": "Integer", 21 | "required": false 22 | } 23 | ] 24 | }, 25 | { 26 | "path": "/api/v1/accounts/:id/mute", 27 | "method": "POST", 28 | "description": "Mute account", 29 | "return": "Relationship", 30 | "parameters": [ 31 | { 32 | "name": ":id", 33 | "type": "String", 34 | "required": true 35 | }, 36 | { 37 | "name": "notifications", 38 | "type": "Boolean", 39 | "required": false 40 | }, 41 | { 42 | "name": "duration", 43 | "type": "Number", 44 | "required": false 45 | } 46 | ] 47 | }, 48 | { 49 | "path": "/api/v1/accounts/:id/unmute", 50 | "method": "POST", 51 | "description": "Unmute account", 52 | "return": "Relationship", 53 | "parameters": [ 54 | { 55 | "name": ":id", 56 | "type": "String", 57 | "required": true 58 | } 59 | ] 60 | } 61 | ] 62 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/oembed.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/oembed", 4 | "method": "GET", 5 | "description": "Get OEmbed info as JSON", 6 | "return": "OEmbed", 7 | "parameters": [ 8 | { 9 | "name": "url", 10 | "type": "String", 11 | "required": true 12 | }, 13 | { 14 | "name": "maxwidth", 15 | "type": "Number", 16 | "required": false 17 | }, 18 | { 19 | "name": "maxheight", 20 | "type": "Number", 21 | "required": false 22 | } 23 | ] 24 | } 25 | ] 26 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/polls.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/polls/:id", 4 | "method": "GET", 5 | "description": "View a poll", 6 | "return": "Poll", 7 | "parameters": [ 8 | { 9 | "name": ":id", 10 | "type": "String", 11 | "required": true 12 | } 13 | ] 14 | }, 15 | { 16 | "path": "/api/v1/polls/:id/votes", 17 | "method": "POST", 18 | "description": "Vote on a poll", 19 | "return": "Poll", 20 | "parameters": [ 21 | { 22 | "name": ":id", 23 | "type": "String", 24 | "required": true 25 | }, 26 | { 27 | "name": "choices", 28 | "type": "Array Integer", 29 | "required": true 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/preferences.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/preferences", 4 | "method": "GET", 5 | "description": "View user preferences", 6 | "return": "Dict String,Object", 7 | "parameters": [] 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/profile.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/profile/avatar", 4 | "name": "DeleteAvatar", 5 | "method": "DELETE", 6 | "description": "Deletes the avatar associated with the user's profile", 7 | "return": "CredentialAccount", 8 | "parameters": [] 9 | }, 10 | { 11 | "path": "/api/v1/profile/header", 12 | "name": "DeleteHeader", 13 | "method": "DELETE", 14 | "description": "Deletes the header image associated with the user's profile", 15 | "return": "CredentialAccount", 16 | "parameters": [] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/reports.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/reports", 4 | "method": "POST", 5 | "description": "File a report", 6 | "return": "Report", 7 | "parameters": [ 8 | { 9 | "name": "account_id", 10 | "type": "String", 11 | "required": true 12 | }, 13 | { 14 | "name": "status_ids", 15 | "type": "Array String", 16 | "required": false 17 | }, 18 | { 19 | "name": "comment", 20 | "type": "String", 21 | "required": false 22 | }, 23 | { 24 | "name": "forward", 25 | "type": "Boolean", 26 | "required": false 27 | }, 28 | { 29 | "name": "category", 30 | "type": "String", 31 | "required": false 32 | }, 33 | { 34 | "name": "rule_ids", 35 | "type": "Array Integer", 36 | "required": false 37 | } 38 | ] 39 | } 40 | ] 41 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/scheduled_statuses.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/scheduled_statuses", 4 | "method": "GET", 5 | "description": "View scheduled statuses", 6 | "return": "Array ScheduledStatus", 7 | "parameters": [ 8 | { 9 | "name": "max_id", 10 | "type": "String", 11 | "required": false 12 | }, 13 | { 14 | "name": "since_id", 15 | "type": "String", 16 | "required": false 17 | }, 18 | { 19 | "name": "min_id", 20 | "type": "String", 21 | "required": false 22 | }, 23 | { 24 | "name": "limit", 25 | "type": "Integer", 26 | "required": false 27 | } 28 | ] 29 | }, 30 | { 31 | "path": "/api/v1/scheduled_statuses/:id", 32 | "method": "GET", 33 | "description": "View a single scheduled status", 34 | "return": "ScheduledStatus", 35 | "parameters": [ 36 | { 37 | "name": ":id", 38 | "type": "String", 39 | "required": true 40 | } 41 | ] 42 | }, 43 | { 44 | "path": "/api/v1/scheduled_statuses/:id", 45 | "method": "PUT", 46 | "description": "Update a scheduled status's publishing date", 47 | "return": "ScheduledStatus", 48 | "parameters": [ 49 | { 50 | "name": ":id", 51 | "type": "String", 52 | "required": true 53 | }, 54 | { 55 | "name": "scheduled_at", 56 | "note": "format: \"2019-01-01 12:00:00\"", 57 | "type": "String", 58 | "required": false 59 | } 60 | ] 61 | }, 62 | { 63 | "path": "/api/v1/scheduled_statuses/:id", 64 | "method": "DELETE", 65 | "description": "Cancel a scheduled status", 66 | "return": "Empty", 67 | "parameters": [ 68 | { 69 | "name": ":id", 70 | "type": "String", 71 | "required": true 72 | } 73 | ] 74 | } 75 | ] 76 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/search.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v2/search", 4 | "method": "GET", 5 | "description": "Perform a search", 6 | "return": "Search", 7 | "parameters": [ 8 | { 9 | "name": "q", 10 | "type": "String", 11 | "required": true 12 | }, 13 | { 14 | "name": "type", 15 | "note": "allowed values of types: \"accounts\", \"hashtags\", \"statuses\"", 16 | "type": "String", 17 | "required": false 18 | }, 19 | { 20 | "name": "resolve", 21 | "type": "Boolean", 22 | "required": false 23 | }, 24 | { 25 | "name": "following", 26 | "type": "Boolean", 27 | "required": false 28 | }, 29 | { 30 | "name": "account_id", 31 | "type": "String", 32 | "required": false 33 | }, 34 | { 35 | "name": "exclude_unreviewed", 36 | "type": "Boolean", 37 | "required": false 38 | }, 39 | { 40 | "name": "max_id", 41 | "type": "String", 42 | "required": false 43 | }, 44 | { 45 | "name": "min_id", 46 | "type": "String", 47 | "required": false 48 | }, 49 | { 50 | "name": "limit", 51 | "type": "Integer", 52 | "required": false 53 | }, 54 | { 55 | "name": "offset", 56 | "type": "Integer", 57 | "required": false 58 | } 59 | ] 60 | } 61 | ] 62 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/suggestions.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v2/suggestions", 4 | "method": "GET", 5 | "description": "View follow suggestions", 6 | "return": "Array Suggestion", 7 | "parameters": [ 8 | { 9 | "name": "limit", 10 | "type": "Integer", 11 | "required": false 12 | } 13 | ] 14 | }, 15 | { 16 | "path": "/api/v1/suggestions/:account_id", 17 | "method": "DELETE", 18 | "description": "Remove a suggestion", 19 | "return": "Empty", 20 | "parameters": [ 21 | { 22 | "name": ":account_id", 23 | "type": "String", 24 | "required": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/tags.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/tags/:tag", 4 | "method": "GET", 5 | "description": "View information about a single tag", 6 | "return": "Tag", 7 | "parameters": [ 8 | { 9 | "name": ":tag", 10 | "type": "String", 11 | "required": true 12 | } 13 | ] 14 | }, 15 | { 16 | "path": "/api/v1/followed_tags", 17 | "method": "GET", 18 | "description": "View all followed tags", 19 | "return": "Array Tag", 20 | "parameters": [ 21 | { 22 | "name": "max_id", 23 | "type": "Integer", 24 | "required": false 25 | }, 26 | { 27 | "name": "since_id", 28 | "type": "Integer", 29 | "required": false 30 | }, 31 | { 32 | "name": "min_id", 33 | "type": "Integer", 34 | "required": false 35 | }, 36 | { 37 | "name": "limit", 38 | "type": "Integer", 39 | "required": false 40 | } 41 | ] 42 | }, 43 | { 44 | "path": "/api/v1/tags/:tag/follow", 45 | "method": "POST", 46 | "description": "Follow a hashtag", 47 | "return": "Tag", 48 | "parameters": [ 49 | { 50 | "name": ":tag", 51 | "type": "String", 52 | "required": true 53 | } 54 | ] 55 | }, 56 | { 57 | "path": "/api/v1/tags/:tag/unfollow", 58 | "method": "POST", 59 | "description": "Unfollow a hashtag", 60 | "return": "Tag", 61 | "parameters": [ 62 | { 63 | "name": ":tag", 64 | "type": "String", 65 | "required": true 66 | } 67 | ] 68 | } 69 | ] 70 | -------------------------------------------------------------------------------- /TootNet.Generator/api_templates/trends.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/api/v1/trends/tags", 4 | "method": "GET", 5 | "description": "View trending tags", 6 | "return": "Array Tag", 7 | "parameters": [ 8 | { 9 | "name": "limit", 10 | "type": "Integer", 11 | "required": false 12 | }, 13 | { 14 | "name": "offset", 15 | "type": "Integer", 16 | "required": false 17 | } 18 | ] 19 | }, 20 | { 21 | "path": "/api/v1/trends/statuses", 22 | "method": "GET", 23 | "description": "View trending statuses", 24 | "return": "Array Status", 25 | "parameters": [ 26 | { 27 | "name": "limit", 28 | "type": "Integer", 29 | "required": false 30 | }, 31 | { 32 | "name": "offset", 33 | "type": "Integer", 34 | "required": false 35 | } 36 | ] 37 | }, 38 | { 39 | "path": "/api/v1/trends/links", 40 | "method": "GET", 41 | "description": "View trending links", 42 | "return": "Array TrendsLink", 43 | "parameters": [ 44 | { 45 | "name": "limit", 46 | "type": "Integer", 47 | "required": false 48 | }, 49 | { 50 | "name": "offset", 51 | "type": "Integer", 52 | "required": false 53 | } 54 | ] 55 | } 56 | ] 57 | -------------------------------------------------------------------------------- /TootNet.Generator/mastodon_docs/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cucmberium/TootNet/0f9a1fe7b4f92edf8b4f4978c985818cb2fb9998/TootNet.Generator/mastodon_docs/.keep -------------------------------------------------------------------------------- /TootNet.Generator/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "tootnet-generator" 3 | version = "0.1.0" 4 | description = "" 5 | authors = ["cucmberium "] 6 | packages = [ 7 | {include="tootnet", from="src"}, 8 | ] 9 | 10 | [tool.poetry.dependencies] 11 | python = "^3.11" 12 | 13 | [tool.poetry.group.dev.dependencies] 14 | black = "^23.7.0" 15 | pyproject-flake8 = "^6.0.0.post1" 16 | mypy = "^1.5.1" 17 | isort = "^5.12.0" 18 | 19 | [tool.black] 20 | line-length = 120 21 | 22 | [tool.isort] 23 | line_length = 120 24 | multi_line_output = 3 25 | include_trailing_comma = true 26 | 27 | [tool.mypy] 28 | no_strict_optional = true 29 | ignore_missing_imports = true 30 | check_untyped_defs = true 31 | 32 | [tool.flake8] 33 | max-line-length = 120 34 | max-complexity = 18 35 | ignore = "E203,E266,E501,W503," 36 | 37 | [tool.poetry.scripts] 38 | tootnet = "tootnet.main:main" 39 | 40 | [build-system] 41 | requires = ["poetry-core"] 42 | build-backend = "poetry.core.masonry.api" 43 | -------------------------------------------------------------------------------- /TootNet.Generator/src/tootnet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cucmberium/TootNet/0f9a1fe7b4f92edf8b4f4978c985818cb2fb9998/TootNet.Generator/src/tootnet/__init__.py -------------------------------------------------------------------------------- /TootNet.Generator/src/tootnet/main.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import logging 3 | from typing import Any 4 | 5 | from generate_cs_code import main as generate_cs_code_main 6 | from generate_template import main as generate_template_main 7 | 8 | 9 | def get_logger(debug: bool = False) -> logging.Logger: 10 | logger = logging.getLogger(__name__) 11 | handler = logging.StreamHandler() 12 | if debug: 13 | logger.setLevel(logging.DEBUG) 14 | handler.setLevel(logging.DEBUG) 15 | else: 16 | logger.setLevel(logging.INFO) 17 | handler.setLevel(logging.INFO) 18 | handler.setFormatter( 19 | logging.Formatter(fmt="%(asctime)s [%(levelname)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S %z") 20 | ) 21 | logger.addHandler(handler) 22 | return logger 23 | 24 | 25 | def generate_template(args: Any) -> None: 26 | generate_template_main(args.doc_dir, args.output_dir, get_logger()) 27 | 28 | 29 | def generate_cs_code(args: Any) -> None: 30 | generate_cs_code_main(args.template_dir, args.output_dir, get_logger()) 31 | 32 | 33 | def main() -> None: 34 | parser = argparse.ArgumentParser(prog="tootnet", description="tootnet generator", add_help=True) 35 | subparsers = parser.add_subparsers() 36 | 37 | parser_generate_template = subparsers.add_parser("generate_template", help="generate template") 38 | parser_generate_template.add_argument( 39 | "-d", "--doc-dir", required=True, type=str, help="dir to mastodon documentation" 40 | ) 41 | parser_generate_template.add_argument( 42 | "-o", "--output-dir", required=True, type=str, help="output dir of api template" 43 | ) 44 | parser_generate_template.set_defaults(handler=generate_template) 45 | 46 | parser_generate_cs_code = subparsers.add_parser("generate_cs_code", help="generate csharp code from template") 47 | parser_generate_cs_code.add_argument("-t", "--template-dir", required=True, type=str, help="dir to template") 48 | parser_generate_cs_code.add_argument( 49 | "-o", "--output-dir", required=True, type=str, help="output dir of csharp code" 50 | ) 51 | parser_generate_cs_code.set_defaults(handler=generate_cs_code) 52 | 53 | args = parser.parse_args() 54 | if hasattr(args, "handler"): 55 | args.handler(args) 56 | else: 57 | parser.print_help() 58 | 59 | 60 | if __name__ == "__main__": 61 | main() 62 | -------------------------------------------------------------------------------- /TootNet.Tests/AccountInformation.cs.example: -------------------------------------------------------------------------------- 1 | namespace TootNet.Tests 2 | { 3 | public static class AccountInformation 4 | { 5 | public const string Instance = "mastodon.social"; 6 | public const string ClientId = ""; 7 | public const string ClientSecret = ""; 8 | public const string AccessToken = ""; 9 | 10 | public static Tokens GetTokens() 11 | { 12 | return new Tokens(Instance, AccessToken, ClientId, ClientSecret); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /TootNet.Tests/AnnouncementsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | using Xunit; 4 | 5 | namespace TootNet.Tests 6 | { 7 | public class AnnouncementsTests 8 | { 9 | [Fact] 10 | public async Task GetAsyncTest() 11 | { 12 | var tokens = AccountInformation.GetTokens(); 13 | 14 | var announcements = await tokens.Announcements.GetAsync(); 15 | 16 | foreach (var announcement in announcements) 17 | { 18 | Assert.NotNull(announcement.Content); 19 | } 20 | } 21 | 22 | [Fact] 23 | public async Task DismissAsyncTest() 24 | { 25 | var tokens = AccountInformation.GetTokens(); 26 | 27 | var oldAnnouncement = (await tokens.Announcements.GetAsync()).First(); 28 | 29 | await Task.Delay(1000); 30 | 31 | await tokens.Announcements.DismissAsync(id => oldAnnouncement.Id); 32 | 33 | await Task.Delay(1000); 34 | 35 | var newAnnouncement = (await tokens.Announcements.GetAsync()).First(announcement => announcement.Id == oldAnnouncement.Id); 36 | 37 | Assert.True(newAnnouncement.Read); 38 | } 39 | 40 | [Fact] 41 | public async Task PutReactionAsyncTest() 42 | { 43 | var tokens = AccountInformation.GetTokens(); 44 | 45 | var announcement = (await tokens.Announcements.GetAsync()).First(); 46 | 47 | await Task.Delay(1000); 48 | 49 | await tokens.Announcements.PutReactionAsync(id => announcement.Id, name => "mastodon"); 50 | } 51 | 52 | [Fact] 53 | public async Task DeleteReactionAsyncTest() 54 | { 55 | var tokens = AccountInformation.GetTokens(); 56 | 57 | var announcement = (await tokens.Announcements.GetAsync()).First(); 58 | 59 | await Task.Delay(1000); 60 | 61 | await tokens.Announcements.DeleteReactionAsync(id => announcement.Id, name => "mastodon"); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /TootNet.Tests/AppsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class AppsTests 7 | { 8 | [Fact] 9 | public async Task VerifyCredentialsAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | var app = await tokens.Apps.VerifyCredentialsAsync(); 14 | 15 | Assert.NotNull(app.Name); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TootNet.Tests/BlocksTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | using Xunit; 5 | 6 | namespace TootNet.Tests 7 | { 8 | public class BlocksTests 9 | { 10 | [Fact] 11 | public async Task GetAsyncTest() 12 | { 13 | var tokens = AccountInformation.GetTokens(); 14 | 15 | var relationship = (await tokens.Accounts.RelationshipsAsync(id => new List { 13179 })).First(); 16 | 17 | await Task.Delay(1000); 18 | 19 | if (!relationship.Blocking) 20 | await tokens.Blocks.BlockAsync(id => 13179); 21 | 22 | await Task.Delay(1000); 23 | 24 | var accounts = await tokens.Blocks.GetAsync(); 25 | 26 | Assert.NotEmpty(accounts); 27 | Assert.Contains(accounts, x => x.Id == 13179); 28 | 29 | await Task.Delay(1000); 30 | 31 | await tokens.Blocks.UnblockAsync(id => 13179); 32 | } 33 | 34 | [Fact] 35 | public async Task BlockAsyncTest() 36 | { 37 | var tokens = AccountInformation.GetTokens(); 38 | 39 | var oldRelationship = (await tokens.Accounts.RelationshipsAsync(id => new List { 13179 })).First(); 40 | 41 | await Task.Delay(1000); 42 | 43 | if (oldRelationship.Blocking) 44 | await tokens.Blocks.UnblockAsync(id => 13179); 45 | 46 | await Task.Delay(1000); 47 | 48 | var relationship = await tokens.Blocks.BlockAsync(id => 13179); 49 | 50 | Assert.True(relationship.Blocking); 51 | 52 | await tokens.Blocks.UnblockAsync(id => 13179); 53 | } 54 | 55 | [Fact] 56 | public async Task UnblockAsyncTest() 57 | { 58 | var tokens = AccountInformation.GetTokens(); 59 | 60 | var oldRelationship = (await tokens.Accounts.RelationshipsAsync(id => new List { 13179 })).First(); 61 | 62 | await Task.Delay(1000); 63 | 64 | if (!oldRelationship.Blocking) 65 | await tokens.Blocks.BlockAsync(id => 13179); 66 | 67 | await Task.Delay(1000); 68 | 69 | var relationship = await tokens.Blocks.UnblockAsync(id => 13179); 70 | 71 | Assert.False(relationship.Blocking); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /TootNet.Tests/BookmarksTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class BookmarksTests 7 | { 8 | [Fact] 9 | public async Task GetAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | await tokens.Bookmarks.BookmarkAsync(id => 110640658973976934); 14 | 15 | await Task.Delay(1000); 16 | 17 | var bookmarks = await tokens.Bookmarks.GetAsync(); 18 | 19 | Assert.NotEmpty(bookmarks); 20 | Assert.Contains(bookmarks, x => x.Id == 110640658973976934); 21 | 22 | await Task.Delay(1000); 23 | 24 | await tokens.Bookmarks.UnbookmarkAsync(id => 110640658973976934); 25 | } 26 | 27 | [Fact] 28 | public async Task BookmarkAsyncTest() 29 | { 30 | var tokens = AccountInformation.GetTokens(); 31 | 32 | await tokens.Bookmarks.BookmarkAsync(id => 110640658973976934); 33 | 34 | await Task.Delay(1000); 35 | 36 | var bookmarks = await tokens.Bookmarks.GetAsync(); 37 | 38 | Assert.NotEmpty(bookmarks); 39 | Assert.Contains(bookmarks, x => x.Id == 110640658973976934); 40 | 41 | await Task.Delay(1000); 42 | 43 | await tokens.Bookmarks.UnbookmarkAsync(id => 110640658973976934); 44 | } 45 | 46 | [Fact] 47 | public async Task UnblockAsyncTest() 48 | { 49 | var tokens = AccountInformation.GetTokens(); 50 | 51 | await tokens.Bookmarks.UnbookmarkAsync(id => 110640658973976934); 52 | 53 | await Task.Delay(1000); 54 | 55 | var bookmarks = await tokens.Bookmarks.GetAsync(); 56 | 57 | Assert.DoesNotContain(bookmarks, x => x.Id == 110640658973976934); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /TootNet.Tests/ConversationsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | using Xunit; 4 | 5 | namespace TootNet.Tests 6 | { 7 | public class ConversationsTests 8 | { 9 | [Fact] 10 | public async Task GetAsyncTest() 11 | { 12 | var tokens = AccountInformation.GetTokens(); 13 | 14 | await tokens.Statuses.PostAsync(status => "@cucmberium@mstdn.maud.io test", visibility => "direct"); 15 | 16 | await Task.Delay(1000); 17 | 18 | var conversations = await tokens.Conversations.GetAsync(); 19 | 20 | Assert.NotEmpty(conversations); 21 | 22 | await Task.Delay(1000); 23 | 24 | await tokens.Conversations.DeleteAsync(id => conversations.First().Id); 25 | } 26 | 27 | [Fact] 28 | public async Task DeleteAsyncTest() 29 | { 30 | var tokens = AccountInformation.GetTokens(); 31 | 32 | await tokens.Statuses.PostAsync(status => "@cucmberium@mstdn.maud.io test", visibility => "direct"); 33 | 34 | await Task.Delay(1000); 35 | 36 | var oldConversations = await tokens.Conversations.GetAsync(); 37 | 38 | await Task.Delay(1000); 39 | 40 | await tokens.Conversations.DeleteAsync(id => oldConversations.First().Id); 41 | 42 | await Task.Delay(1000); 43 | 44 | var newConversations = await tokens.Conversations.GetAsync(); 45 | 46 | Assert.DoesNotContain(newConversations, conversation => conversation.Id == oldConversations.First().Id); 47 | 48 | } 49 | 50 | [Fact] 51 | public async Task ReadAsyncTest() 52 | { 53 | var tokens = AccountInformation.GetTokens(); 54 | 55 | await tokens.Statuses.PostAsync(status => "@cucmberium@mstdn.maud.io test", visibility => "direct"); 56 | 57 | await Task.Delay(1000); 58 | 59 | var oldConversations = await tokens.Conversations.GetAsync(); 60 | 61 | await Task.Delay(1000); 62 | 63 | await tokens.Conversations.ReadAsync(id => oldConversations.First().Id); 64 | 65 | await Task.Delay(1000); 66 | 67 | var newConversations = await tokens.Conversations.GetAsync(); 68 | 69 | Assert.False(newConversations.First().Unread); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /TootNet.Tests/CustomEmojisTests.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | using Xunit; 4 | 5 | namespace TootNet.Tests 6 | { 7 | public class CustomEmojisTests 8 | { 9 | [Fact] 10 | public async Task GetAsyncTest() 11 | { 12 | var tokens = AccountInformation.GetTokens(); 13 | 14 | var emojis = await tokens.CustomEmojis.GetAsync(); 15 | 16 | Assert.NotEmpty(emojis); 17 | Assert.Contains(emojis, x => x.Shortcode == "mastodon"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /TootNet.Tests/Data/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cucmberium/TootNet/0f9a1fe7b4f92edf8b4f4978c985818cb2fb9998/TootNet.Tests/Data/image.png -------------------------------------------------------------------------------- /TootNet.Tests/DirectoryTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class DirectoryTests 7 | { 8 | [Fact] 9 | public async Task GetAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | var accounts = await tokens.Directory.GetAsync(); 14 | 15 | Assert.NotEmpty(accounts); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TootNet.Tests/DomainBlocksTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class DomainBlocksTests 7 | { 8 | [Fact] 9 | public async Task GetAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | await tokens.DomainBlocks.PostAsync(domain => "mstdn.jp"); 14 | 15 | await Task.Delay(1000); 16 | 17 | var domainBlocks = await tokens.DomainBlocks.GetAsync(); 18 | 19 | Assert.True(domainBlocks.Count > 0); 20 | Assert.Contains("mstdn.jp", domainBlocks); 21 | 22 | await Task.Delay(1000); 23 | 24 | await tokens.DomainBlocks.DeleteAsync(domain => "mstdn.jp"); 25 | } 26 | 27 | [Fact] 28 | public async Task PostAsyncTest() 29 | { 30 | var tokens = AccountInformation.GetTokens(); 31 | 32 | await tokens.DomainBlocks.PostAsync(domain => "mstdn.jp"); 33 | 34 | await Task.Delay(1000); 35 | 36 | var domainBlocks = await tokens.DomainBlocks.GetAsync(); 37 | 38 | Assert.True(domainBlocks.Count > 0); 39 | Assert.Contains("mstdn.jp", domainBlocks); 40 | 41 | await Task.Delay(1000); 42 | 43 | await tokens.DomainBlocks.DeleteAsync(domain => "mstdn.jp"); 44 | } 45 | 46 | [Fact] 47 | public async Task DeleteAsyncTest() 48 | { 49 | var tokens = AccountInformation.GetTokens(); 50 | 51 | await tokens.DomainBlocks.PostAsync(domain => "mstdn.jp"); 52 | 53 | await Task.Delay(1000); 54 | 55 | await tokens.DomainBlocks.DeleteAsync(domain => "mstdn.jp"); 56 | 57 | await Task.Delay(1000); 58 | 59 | var domainBlocks = await tokens.DomainBlocks.GetAsync(); 60 | 61 | Assert.DoesNotContain("mstdn.jp", domainBlocks); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /TootNet.Tests/EndorsementsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class EndorsementsTests 7 | { 8 | [Fact] 9 | public async Task GetAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | await tokens.Accounts.FollowAsync(id => 13179); 14 | 15 | await Task.Delay(1000); 16 | 17 | await tokens.Endorsements.PinAsync(id => 13179); 18 | 19 | await Task.Delay(1000); 20 | 21 | var endorsements = await tokens.Endorsements.GetAsync(); 22 | 23 | Assert.NotEmpty(endorsements); 24 | Assert.Contains(endorsements, x => x.Acct == "Mastodon"); 25 | 26 | await Task.Delay(1000); 27 | 28 | await tokens.Endorsements.UnpinAsync(id => 13179); 29 | 30 | await Task.Delay(1000); 31 | 32 | await tokens.Accounts.UnfollowAsync(id => 13179); 33 | } 34 | 35 | [Fact] 36 | public async Task PinAsyncTest() 37 | { 38 | var tokens = AccountInformation.GetTokens(); 39 | 40 | await tokens.Accounts.FollowAsync(id => 13179); 41 | 42 | await Task.Delay(1000); 43 | 44 | await tokens.Endorsements.PinAsync(id => 13179); 45 | 46 | await Task.Delay(1000); 47 | 48 | var endorsements = await tokens.Endorsements.GetAsync(); 49 | 50 | Assert.NotEmpty(endorsements); 51 | Assert.Contains(endorsements, x => x.Acct == "Mastodon"); 52 | 53 | await Task.Delay(1000); 54 | 55 | await tokens.Endorsements.UnpinAsync(id => 13179); 56 | 57 | await Task.Delay(1000); 58 | 59 | await tokens.Accounts.UnfollowAsync(id => 13179); 60 | } 61 | 62 | [Fact] 63 | public async Task UnpinAsyncTest() 64 | { 65 | var tokens = AccountInformation.GetTokens(); 66 | 67 | await tokens.Accounts.FollowAsync(id => 13179); 68 | 69 | await Task.Delay(1000); 70 | 71 | await tokens.Endorsements.PinAsync(id => 13179); 72 | 73 | await Task.Delay(1000); 74 | 75 | await tokens.Endorsements.UnpinAsync(id => 13179); 76 | 77 | await Task.Delay(1000); 78 | 79 | var endorsements = await tokens.Endorsements.GetAsync(); 80 | 81 | Assert.DoesNotContain(endorsements, x => x.Acct == "Mastodon"); 82 | 83 | await Task.Delay(1000); 84 | 85 | await tokens.Accounts.UnfollowAsync(id => 13179); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /TootNet.Tests/FavouritesTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class FavouritesTests 7 | { 8 | [Fact] 9 | public async Task GetAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | var statuses = await tokens.Favourites.GetAsync(limit => 1); 14 | 15 | Assert.Single(statuses); 16 | foreach (var status in statuses) 17 | { 18 | Assert.NotNull(status.Account.Acct); 19 | Assert.NotNull(status.Account.UserName); 20 | Assert.NotNull(status.Account.Url); 21 | Assert.NotNull(status.Content); 22 | } 23 | } 24 | 25 | [Fact] 26 | public async Task FavouriteAsyncTest() 27 | { 28 | var tokens = AccountInformation.GetTokens(); 29 | 30 | var status = await tokens.Statuses.IdAsync(id => 111031128530593092); 31 | 32 | await Task.Delay(1000); 33 | 34 | if (status.Favourited == true) 35 | await tokens.Favourites.UnfavouriteAsync(id => 111031128530593092); 36 | 37 | await Task.Delay(1000); 38 | 39 | var favoritedStatus = await tokens.Favourites.FavouriteAsync(id => 111031128530593092); 40 | 41 | Assert.True(favoritedStatus.Favourited); 42 | 43 | await Task.Delay(1000); 44 | 45 | await tokens.Favourites.UnfavouriteAsync(id => 111031128530593092); 46 | } 47 | 48 | [Fact] 49 | public async Task UnfavouriteAsyncTest() 50 | { 51 | var tokens = AccountInformation.GetTokens(); 52 | 53 | var status = await tokens.Statuses.IdAsync(id => 111031128530593092); 54 | 55 | await Task.Delay(1000); 56 | 57 | if (status.Favourited is false or null) 58 | await tokens.Favourites.FavouriteAsync(id => 111031128530593092); 59 | 60 | await Task.Delay(1000); 61 | 62 | var favoritedStatus = await tokens.Favourites.UnfavouriteAsync(id => 111031128530593092); 63 | 64 | Assert.False(favoritedStatus.Favourited); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /TootNet.Tests/FeaturedTagsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class FeaturedTagsTests 7 | { 8 | [Fact] 9 | public async Task GetAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | var featuredTags = await tokens.FeaturedTags.GetAsync(); 14 | 15 | Assert.NotEmpty(featuredTags); 16 | Assert.Contains(featuredTags, x => x.Name == "tootnet"); 17 | } 18 | 19 | [Fact] 20 | public async Task PostAsyncTest() 21 | { 22 | var tokens = AccountInformation.GetTokens(); 23 | 24 | var featuredTag = await tokens.FeaturedTags.PostAsync(name => "test"); 25 | 26 | await Task.Delay(1000); 27 | 28 | var featuredTags = await tokens.FeaturedTags.GetAsync(); 29 | 30 | Assert.NotEmpty(featuredTags); 31 | Assert.Contains(featuredTags, x => x.Name == "test"); 32 | 33 | await Task.Delay(1000); 34 | 35 | await tokens.FeaturedTags.DeleteAsync(id => featuredTag.Id); 36 | } 37 | 38 | [Fact] 39 | public async Task DeleteAsyncTest() 40 | { 41 | var tokens = AccountInformation.GetTokens(); 42 | 43 | var featuredTag = await tokens.FeaturedTags.PostAsync(name => "test"); 44 | 45 | await Task.Delay(1000); 46 | 47 | await tokens.FeaturedTags.DeleteAsync(id => featuredTag.Id); 48 | 49 | await Task.Delay(1000); 50 | 51 | var featuredTags = await tokens.FeaturedTags.GetAsync(); 52 | 53 | Assert.DoesNotContain(featuredTags, x => x.Name == "test"); 54 | } 55 | 56 | [Fact] 57 | public async Task SuggestionsAsyncTest() 58 | { 59 | var tokens = AccountInformation.GetTokens(); 60 | 61 | var featuredTags = await tokens.FeaturedTags.SuggestionsAsync(); 62 | 63 | Assert.NotEmpty(featuredTags); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /TootNet.Tests/FollowRequestsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class FollowRequestsTests 7 | { 8 | [Fact] 9 | public async Task GetAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | var accounts = await tokens.FollowRequests.GetAsync(limit => 10); 14 | 15 | Assert.NotNull(accounts); 16 | } 17 | 18 | [Fact] 19 | public async Task AuthorizeAsyncTest() 20 | { 21 | var tokens = AccountInformation.GetTokens(); 22 | 23 | var accounts = await tokens.FollowRequests.AuthorizeAsync(account_id => 13179); 24 | 25 | Assert.NotNull(accounts); 26 | } 27 | 28 | [Fact] 29 | public async Task RejectAsyncTest() 30 | { 31 | var tokens = AccountInformation.GetTokens(); 32 | 33 | var accounts = await tokens.FollowRequests.RejectAsync(account_id => 13179); 34 | 35 | Assert.NotNull(accounts); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /TootNet.Tests/GroupedNotificationsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | using Xunit; 4 | 5 | namespace TootNet.Tests 6 | { 7 | public class GroupedNotificationsTests 8 | { 9 | [Fact] 10 | public async Task GetAsyncTest() 11 | { 12 | var tokens = AccountInformation.GetTokens(); 13 | 14 | var notifications = await tokens.GroupedNotifications.GetAsync(); 15 | Assert.NotNull(notifications); 16 | } 17 | 18 | [Fact(Skip = "WIP")] 19 | public async Task GroupKeyAsyncTest() 20 | { 21 | var tokens = AccountInformation.GetTokens(); 22 | 23 | var notifications = await tokens.GroupedNotifications.GetAsync(); 24 | if (!notifications.NotificationGroups.Any()) 25 | return; 26 | 27 | var targetNotification = notifications.NotificationGroups.First(); 28 | 29 | await Task.Delay(1000); 30 | 31 | var notification = await tokens.GroupedNotifications.GroupKeyAsync(group_key => targetNotification.GroupKey); 32 | 33 | Assert.NotNull(notification.NotificationGroups); 34 | } 35 | 36 | [Fact(Skip = "WIP")] 37 | public async Task DismissAsyncTest() 38 | { 39 | var tokens = AccountInformation.GetTokens(); 40 | 41 | var notifications = await tokens.GroupedNotifications.GetAsync(); 42 | if (!notifications.NotificationGroups.Any()) 43 | return; 44 | 45 | var targetNotification = notifications.NotificationGroups.First(); 46 | 47 | await Task.Delay(1000); 48 | 49 | await tokens.GroupedNotifications.DismissAsync(group_key => targetNotification.GroupKey); 50 | } 51 | 52 | [Fact(Skip = "WIP")] 53 | public async Task AccountsAsyncTest() 54 | { 55 | var tokens = AccountInformation.GetTokens(); 56 | 57 | var notifications = await tokens.GroupedNotifications.GetAsync(); 58 | if (!notifications.NotificationGroups.Any()) 59 | return; 60 | 61 | var targetNotification = notifications.NotificationGroups.First(); 62 | 63 | var accounts = await tokens.GroupedNotifications.AccountsAsync(group_key => targetNotification.GroupKey); 64 | 65 | Assert.NotEmpty(accounts); 66 | } 67 | 68 | [Fact] 69 | public async Task UnreadCountAsyncTest() 70 | { 71 | var tokens = AccountInformation.GetTokens(); 72 | 73 | var unreadCount = await tokens.GroupedNotifications.UnreadCountAsync(); 74 | 75 | Assert.Contains("count", unreadCount); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /TootNet.Tests/InstancesTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class InstancesTests 7 | { 8 | [Fact] 9 | public async Task GetAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | var instance = await tokens.Instances.GetAsync(); 14 | 15 | Assert.Equal(tokens.Instance, instance.Domain); 16 | } 17 | 18 | [Fact] 19 | public async Task PeersAsyncTest() 20 | { 21 | var tokens = AccountInformation.GetTokens(); 22 | 23 | var peers = await tokens.Instances.PeersAsync(); 24 | 25 | Assert.NotNull(peers); 26 | } 27 | 28 | [Fact] 29 | public async Task ActivityAsyncTest() 30 | { 31 | var tokens = AccountInformation.GetTokens(); 32 | 33 | var activity = await tokens.Instances.ActivityAsync(); 34 | 35 | Assert.NotNull(activity); 36 | } 37 | 38 | [Fact] 39 | public async Task RulesAsyncTest() 40 | { 41 | var tokens = AccountInformation.GetTokens(); 42 | 43 | var rules = await tokens.Instances.RulesAsync(); 44 | 45 | Assert.NotNull(rules); 46 | } 47 | 48 | [Fact] 49 | public async Task DomainBlocksAsyncTest() 50 | { 51 | var tokens = AccountInformation.GetTokens(); 52 | 53 | var domainBlocks = await tokens.Instances.DomainBlocksAsync(); 54 | 55 | Assert.NotNull(domainBlocks); 56 | } 57 | 58 | [Fact] 59 | public async Task ExtendedDescriptionAsyncTest() 60 | { 61 | var tokens = AccountInformation.GetTokens(); 62 | 63 | var extendedDescription = await tokens.Instances.ExtendedDescriptionAsync(); 64 | 65 | Assert.NotNull(extendedDescription); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /TootNet.Tests/MarkersTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | using Xunit; 5 | 6 | namespace TootNet.Tests 7 | { 8 | public class MarkersTests 9 | { 10 | [Fact] 11 | public async Task GetAsyncTest() 12 | { 13 | var tokens = AccountInformation.GetTokens(); 14 | 15 | var marker = await tokens.Markers.GetAsync(timeline => new List {"home"}); 16 | 17 | Assert.NotNull(marker); 18 | } 19 | 20 | [Fact] 21 | public async Task PostAsyncTest() 22 | { 23 | var tokens = AccountInformation.GetTokens(); 24 | 25 | var homes = await tokens.Timelines.HomeAsync(); 26 | 27 | var marker = await tokens.Markers.PostAsync(new Dictionary {{"home[last_read_id]", homes.First().Id }}); 28 | 29 | Assert.NotNull(marker); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /TootNet.Tests/MediaTests.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading.Tasks; 3 | using Xunit; 4 | 5 | namespace TootNet.Tests 6 | { 7 | public class MediaTests 8 | { 9 | [Fact] 10 | public async Task PostAsyncTest() 11 | { 12 | var tokens = AccountInformation.GetTokens(); 13 | 14 | using (var fs = new FileStream(@"./Data/image.png", FileMode.Open, FileAccess.Read)) 15 | { 16 | var attachment = await tokens.Media.PostAsync(file => fs); 17 | 18 | Assert.NotNull(attachment); 19 | Assert.NotNull(attachment.PreviewUrl); 20 | Assert.NotNull(attachment.Url); 21 | } 22 | } 23 | 24 | [Fact] 25 | public async Task IdAsyncTest() 26 | { 27 | var tokens = AccountInformation.GetTokens(); 28 | 29 | using (var fs = new FileStream(@"./Data/image.png", FileMode.Open, FileAccess.Read)) 30 | { 31 | var uploadedAttachment = await tokens.Media.PostAsync(file => fs); 32 | 33 | await Task.Delay(1000); 34 | 35 | var attachment = await tokens.Media.IdAsync(id => uploadedAttachment.Id); 36 | 37 | Assert.NotNull(attachment); 38 | Assert.Equal(uploadedAttachment.Id, attachment.Id); 39 | Assert.Equal(uploadedAttachment.PreviewUrl, attachment.PreviewUrl); 40 | Assert.Equal(uploadedAttachment.Url, attachment.Url); 41 | } 42 | } 43 | 44 | [Fact] 45 | public async Task PutAsyncTest() 46 | { 47 | var tokens = AccountInformation.GetTokens(); 48 | 49 | using (var fs = new FileStream(@"./Data/image.png", FileMode.Open, FileAccess.Read)) 50 | { 51 | var attachment = await tokens.Media.PostAsync(file => fs); 52 | 53 | await Task.Delay(1000); 54 | 55 | var updatedAttachment = await tokens.Media.PutAsync(id => attachment.Id, description => "test"); 56 | 57 | Assert.NotNull(updatedAttachment); 58 | Assert.NotNull(updatedAttachment.PreviewUrl); 59 | Assert.NotNull(updatedAttachment.Url); 60 | Assert.Equal("test", updatedAttachment.Description); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /TootNet.Tests/MutesTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | using Xunit; 5 | 6 | namespace TootNet.Tests 7 | { 8 | public class MutesTests 9 | { 10 | [Fact] 11 | public async Task GetAsyncTest() 12 | { 13 | var tokens = AccountInformation.GetTokens(); 14 | 15 | var relationship = (await tokens.Accounts.RelationshipsAsync(id => new List { 13179 })).First(); 16 | 17 | await Task.Delay(1000); 18 | 19 | if (!relationship.Muting) 20 | await tokens.Mutes.MuteAsync(id => 13179); 21 | 22 | await Task.Delay(1000); 23 | 24 | var accounts = await tokens.Mutes.GetAsync(); 25 | 26 | Assert.NotNull(accounts); 27 | Assert.True(accounts.Count > 0); 28 | Assert.Contains(accounts, x => x.Id == 13179); 29 | 30 | await Task.Delay(1000); 31 | 32 | await tokens.Mutes.UnmuteAsync(id => 13179); 33 | } 34 | 35 | [Fact] 36 | public async Task MuteAccountAsyncTest() 37 | { 38 | var tokens = AccountInformation.GetTokens(); 39 | 40 | var oldRelationship = (await tokens.Accounts.RelationshipsAsync(id => new List { 13179 })).First(); 41 | 42 | await Task.Delay(1000); 43 | 44 | if (oldRelationship.Muting) 45 | await tokens.Mutes.UnmuteAsync(id => 13179); 46 | 47 | await Task.Delay(1000); 48 | 49 | var relationship = await tokens.Mutes.MuteAsync(id => 13179); 50 | 51 | Assert.True(relationship.Muting); 52 | 53 | await tokens.Mutes.UnmuteAsync(id => 13179); 54 | } 55 | 56 | [Fact] 57 | public async Task UnmuteAccountAsyncTest() 58 | { 59 | var tokens = AccountInformation.GetTokens(); 60 | 61 | var oldRelationship = (await tokens.Accounts.RelationshipsAsync(id => new List { 13179 })).First(); 62 | 63 | await Task.Delay(1000); 64 | 65 | if (!oldRelationship.Muting) 66 | await tokens.Mutes.MuteAsync(id => 13179); 67 | 68 | await Task.Delay(1000); 69 | 70 | var relationship = await tokens.Mutes.UnmuteAsync(id => 13179); 71 | 72 | Assert.False(relationship.Muting); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /TootNet.Tests/OEmbedTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class OEmbedTests 7 | { 8 | [Fact] 9 | public async Task GetAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | var oembed = await tokens.OEmbed.GetAsync(url => "https://mastodon.social/@tootnet/111155004820251442"); 14 | 15 | Assert.NotNull(oembed); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TootNet.Tests/PollTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Xunit; 4 | 5 | namespace TootNet.Tests 6 | { 7 | public class PollTests 8 | { 9 | [Fact] 10 | public async Task IdAsyncTest() 11 | { 12 | var tokens = AccountInformation.GetTokens(); 13 | 14 | var poll = await tokens.Polls.IdAsync(id => 659057); 15 | 16 | Assert.NotNull(poll); 17 | } 18 | 19 | [Fact(Skip = "WIP")] 20 | public async Task VoteAsyncTest() 21 | { 22 | var tokens = AccountInformation.GetTokens(); 23 | 24 | var poll = await tokens.Polls.VotesAsync(id => 659057, choices => new List { 0 }); 25 | 26 | Assert.NotNull(poll); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /TootNet.Tests/PreferencesTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class PreferencesTests 7 | { 8 | [Fact] 9 | public async Task GetAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | var preferences = await tokens.Preferences.GetAsync(); 14 | 15 | Assert.NotNull(preferences); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TootNet.Tests/ProfileTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class ProfileTests 7 | { 8 | [Fact] 9 | public async Task DeleteAvatarAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | var account = await tokens.Profile.DeleteAvatarAsync(); 14 | 15 | Assert.NotNull(account); 16 | } 17 | 18 | [Fact] 19 | public async Task DeleteHeaderAsyncTest() 20 | { 21 | var tokens = AccountInformation.GetTokens(); 22 | 23 | var account = await tokens.Profile.DeleteHeaderAsync(); 24 | 25 | Assert.NotNull(account); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /TootNet.Tests/ReportsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class ReportsTests 7 | { 8 | [Fact(Skip = "WIP")] 9 | public async Task PostAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | var report = await tokens.Reports.PostAsync(account_id => 13179); 14 | 15 | Assert.NotNull(report); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TootNet.Tests/ScheduledStatusesTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Threading.Tasks; 4 | using Xunit; 5 | 6 | namespace TootNet.Tests 7 | { 8 | public class ScheduledStatusesTests 9 | { 10 | [Fact] 11 | public async Task GetAsyncTest() 12 | { 13 | long statusId = 0; 14 | var tokens = AccountInformation.GetTokens(); 15 | using (var fs = new FileStream(@"./Data/image.png", FileMode.Open, FileAccess.Read)) 16 | { 17 | var attachment = await tokens.Media.PostAsync(file => fs); 18 | 19 | await Task.Delay(1000); 20 | 21 | var scheduledStatus = await tokens.Statuses.PostAsync(status => "test toot future", visibility => "private", scheduled_at => "2025-12-24 12:00:00", media_ids => new List { attachment.Id }); 22 | 23 | statusId = scheduledStatus.Id; 24 | } 25 | 26 | await Task.Delay(1000); 27 | 28 | var scheduledStatuses = await tokens.ScheduledStatuses.GetAsync(); 29 | 30 | Assert.NotNull(scheduledStatuses); 31 | Assert.NotEmpty(scheduledStatuses); 32 | 33 | await Task.Delay(1000); 34 | 35 | await tokens.ScheduledStatuses.DeleteAsync(id => statusId); 36 | } 37 | 38 | [Fact] 39 | public async Task IdAsyncTest() 40 | { 41 | var tokens = AccountInformation.GetTokens(); 42 | 43 | var scheduledStatus = await tokens.Statuses.PostAsync(status => "test toot future2", visibility => "private", scheduled_at => "2025-12-24 12:00:00"); 44 | 45 | await Task.Delay(1000); 46 | 47 | var scheduledStatus2 = await tokens.ScheduledStatuses.IdAsync(id => scheduledStatus.Id); 48 | 49 | Assert.NotNull(scheduledStatus2); 50 | Assert.True(scheduledStatus2.Params.Text == "test toot future2"); 51 | 52 | await Task.Delay(1000); 53 | 54 | await tokens.ScheduledStatuses.DeleteAsync(id => scheduledStatus.Id); 55 | } 56 | 57 | [Fact] 58 | public async Task PutAsyncTest() 59 | { 60 | var tokens = AccountInformation.GetTokens(); 61 | 62 | var scheduledStatus = await tokens.Statuses.PostAsync(status => "test toot future3", visibility => "private", scheduled_at => "2025-12-24 12:00:00"); 63 | 64 | await Task.Delay(1000); 65 | 66 | var scheduledStatus2 = await tokens.ScheduledStatuses.IdAsync(id => scheduledStatus.Id); 67 | 68 | await Task.Delay(1000); 69 | 70 | var scheduledStatus3 = await tokens.ScheduledStatuses.PutAsync(id => scheduledStatus.Id, scheduled_at => "2026-12-24 11:00:00"); 71 | 72 | Assert.NotNull(scheduledStatus3); 73 | Assert.True(scheduledStatus2.ScheduledAt < scheduledStatus3.ScheduledAt); 74 | 75 | await Task.Delay(1000); 76 | 77 | await tokens.ScheduledStatuses.DeleteAsync(id => scheduledStatus.Id); 78 | } 79 | 80 | [Fact] 81 | public async Task DeleteAsyncTest() 82 | { 83 | var tokens = AccountInformation.GetTokens(); 84 | 85 | var scheduledStatuses = await tokens.ScheduledStatuses.GetAsync(); 86 | foreach (var status in scheduledStatuses) 87 | { 88 | await tokens.ScheduledStatuses.DeleteAsync(id => status.Id); 89 | } 90 | 91 | var scheduledStatus = await tokens.Statuses.PostAsync(status => "test toot future4", visibility => "private", scheduled_at => "2025-12-24 12:00:00"); 92 | 93 | await Task.Delay(1000); 94 | 95 | await tokens.ScheduledStatuses.DeleteAsync(id => scheduledStatus.Id); 96 | 97 | await Task.Delay(1000); 98 | 99 | var scheduledStatuses2 = await tokens.ScheduledStatuses.GetAsync(); 100 | 101 | Assert.NotNull(scheduledStatuses2); 102 | Assert.Empty(scheduledStatuses2); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /TootNet.Tests/SearchTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class SearchTests 7 | { 8 | [Fact] 9 | public async Task GetAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | var search = await tokens.Search.GetAsync(q => "きゅうりうむ"); 14 | 15 | Assert.NotNull(search); 16 | Assert.NotNull(search.Statuses); 17 | Assert.NotNull(search.Accounts); 18 | Assert.NotNull(search.Hashtags); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /TootNet.Tests/SuggestionsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | using Xunit; 4 | 5 | namespace TootNet.Tests 6 | { 7 | public class SuggestionsTests 8 | { 9 | [Fact] 10 | public async Task GetAsyncTest() 11 | { 12 | var tokens = AccountInformation.GetTokens(); 13 | 14 | var accounts = await tokens.Suggestions.GetAsync(); 15 | 16 | Assert.NotEmpty(accounts); 17 | } 18 | 19 | [Fact] 20 | public async Task DeleteAsync() 21 | { 22 | var tokens = AccountInformation.GetTokens(); 23 | 24 | var accounts = await tokens.Suggestions.GetAsync(); 25 | 26 | await Task.Delay(1000); 27 | 28 | var targetAccountId = accounts.First().Account.Id; 29 | await tokens.Suggestions.DeleteAsync(account_id => targetAccountId); 30 | 31 | await Task.Delay(1000); 32 | 33 | var removedAccounts = await tokens.Suggestions.GetAsync(); 34 | Assert.Empty(removedAccounts.Where(x => x.Account.Id == targetAccountId)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /TootNet.Tests/TagsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class TagsTest 7 | { 8 | [Fact] 9 | public async Task IdAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | var tag = await tokens.Tags.GetAsync(tag => "mastodon"); 14 | 15 | Assert.NotNull(tag.Name); 16 | } 17 | 18 | [Fact] 19 | public async Task FollowedTagsAsyncTest() 20 | { 21 | var tokens = AccountInformation.GetTokens(); 22 | 23 | var tags = await tokens.Tags.FollowedTagsAsync(); 24 | 25 | Assert.Single(tags); 26 | foreach (var tag in tags) 27 | { 28 | Assert.NotNull(tag.Name); 29 | } 30 | } 31 | 32 | [Fact] 33 | public async Task FollowAsyncTest() 34 | { 35 | var tokens = AccountInformation.GetTokens(); 36 | 37 | var oldTag = await tokens.Tags.GetAsync(tag => "test"); 38 | 39 | await Task.Delay(1000); 40 | 41 | if (oldTag.Following == true) 42 | await tokens.Tags.UnfollowAsync(tag => "test"); 43 | 44 | await Task.Delay(1000); 45 | 46 | var newTag = await tokens.Tags.FollowAsync(tag => "test"); 47 | 48 | Assert.True(newTag.Following); 49 | 50 | await Task.Delay(1000); 51 | 52 | await tokens.Tags.UnfollowAsync(tag => "test"); 53 | } 54 | 55 | [Fact] 56 | public async Task UnfollowAsyncTest() 57 | { 58 | var tokens = AccountInformation.GetTokens(); 59 | 60 | var oldTag = await tokens.Tags.GetAsync(tag => "test"); 61 | 62 | await Task.Delay(1000); 63 | 64 | if (oldTag.Following is false or null) 65 | await tokens.Tags.FollowAsync(tag => "test"); 66 | 67 | await Task.Delay(1000); 68 | 69 | var newTag = await tokens.Tags.UnfollowAsync(tag => "test"); 70 | 71 | Assert.False(newTag.Following); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /TootNet.Tests/TimelinesTests.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | using Xunit; 4 | 5 | namespace TootNet.Tests 6 | { 7 | public class TimelinesTests 8 | { 9 | [Fact] 10 | public async Task HomeAsyncTest() 11 | { 12 | var tokens = AccountInformation.GetTokens(); 13 | 14 | var statuses = await tokens.Timelines.HomeAsync(limit => 10); 15 | 16 | Assert.Equal(10, statuses.Count); 17 | foreach (var status in statuses) 18 | { 19 | Assert.NotNull(status.Account.Acct); 20 | Assert.NotNull(status.Account.UserName); 21 | Assert.NotNull(status.Account.Url); 22 | Assert.NotNull(status.Content); 23 | } 24 | } 25 | 26 | [Fact] 27 | public async Task PublicAsyncTest() 28 | { 29 | var tokens = AccountInformation.GetTokens(); 30 | 31 | var statuses = await tokens.Timelines.PublicAsync(limit => 10); 32 | 33 | Assert.Equal(10, statuses.Count); 34 | foreach (var status in statuses) 35 | { 36 | Assert.NotNull(status.Account.Acct); 37 | Assert.NotNull(status.Account.UserName); 38 | Assert.NotNull(status.Account.Url); 39 | Assert.NotNull(status.Content); 40 | } 41 | } 42 | 43 | [Fact] 44 | public async Task TagAsyncTest() 45 | { 46 | var tokens = AccountInformation.GetTokens(); 47 | 48 | var statuses = await tokens.Timelines.TagAsync(hashtag => "mastodon", limit => 10); 49 | 50 | Assert.Equal(10, statuses.Count); 51 | foreach (var status in statuses) 52 | { 53 | Assert.NotNull(status.Account.Acct); 54 | Assert.NotNull(status.Account.UserName); 55 | Assert.NotNull(status.Account.Url); 56 | Assert.NotNull(status.Content); 57 | } 58 | } 59 | 60 | [Fact] 61 | public async Task LinkAsyncTest() 62 | { 63 | var tokens = AccountInformation.GetTokens(); 64 | 65 | var trends = await tokens.Trends.LinksAsync(limit => 1); 66 | 67 | var statuses = await tokens.Timelines.LinkAsync(url => trends.First().Url, limit => 10); 68 | 69 | Assert.Equal(10, statuses.Count); 70 | foreach (var status in statuses) 71 | { 72 | Assert.NotNull(status.Account.Acct); 73 | Assert.NotNull(status.Account.UserName); 74 | Assert.NotNull(status.Account.Url); 75 | Assert.NotNull(status.Content); 76 | } 77 | } 78 | 79 | [Fact(Skip = "WIP")] 80 | public async Task ListAsyncTest() 81 | { 82 | var tokens = AccountInformation.GetTokens(); 83 | 84 | var statuses = await tokens.Timelines.ListAsync(list_id => 208, limit => 10); 85 | 86 | Assert.Equal(10, statuses.Count); 87 | foreach (var status in statuses) 88 | { 89 | Assert.NotNull(status.Account.Acct); 90 | Assert.NotNull(status.Account.UserName); 91 | Assert.NotNull(status.Account.Url); 92 | Assert.NotNull(status.Content); 93 | } 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /TootNet.Tests/TootNet.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | all 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Always 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /TootNet.Tests/TrendsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | namespace TootNet.Tests 5 | { 6 | public class TrendsTests 7 | { 8 | [Fact] 9 | public async Task TagsAsyncTest() 10 | { 11 | var tokens = AccountInformation.GetTokens(); 12 | 13 | var tags = await tokens.Trends.TagsAsync(limit => 3); 14 | 15 | Assert.Equal(3, tags.Count); 16 | foreach (var tag in tags) 17 | { 18 | Assert.NotNull(tag.Name); 19 | } 20 | } 21 | 22 | [Fact] 23 | public async Task StatusesAsyncTest() 24 | { 25 | var tokens = AccountInformation.GetTokens(); 26 | 27 | var statuses = await tokens.Trends.StatusesAsync(limit => 3); 28 | 29 | Assert.Equal(3, statuses.Count); 30 | foreach (var status in statuses) 31 | { 32 | Assert.NotNull(status.Account.Acct); 33 | Assert.NotNull(status.Account.UserName); 34 | Assert.NotNull(status.Account.Url); 35 | Assert.NotNull(status.Content); 36 | } 37 | } 38 | 39 | [Fact] 40 | public async Task LinksAsyncTest() 41 | { 42 | var tokens = AccountInformation.GetTokens(); 43 | 44 | var trendsLinks = await tokens.Trends.LinksAsync(limit => 3); 45 | 46 | Assert.Equal(3, trendsLinks.Count); 47 | foreach (var trendLink in trendsLinks) 48 | { 49 | Assert.NotNull(trendLink.History); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /TootNet.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.6.33829.357 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TootNet", "TootNet\TootNet.csproj", "{94535547-BCE1-4952-9BBF-3DBB35DF62D2}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TootNet.Tests", "TootNet.Tests\TootNet.Tests.csproj", "{F39D4179-3DEA-43E8-9629-967A5777BAA8}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TootNet.Demo", "TootNet.Demo\TootNet.Demo.csproj", "{DE1A8100-7077-49D0-8E27-C8A6FCCA092A}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {94535547-BCE1-4952-9BBF-3DBB35DF62D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {94535547-BCE1-4952-9BBF-3DBB35DF62D2}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {94535547-BCE1-4952-9BBF-3DBB35DF62D2}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {94535547-BCE1-4952-9BBF-3DBB35DF62D2}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {F39D4179-3DEA-43E8-9629-967A5777BAA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {F39D4179-3DEA-43E8-9629-967A5777BAA8}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {F39D4179-3DEA-43E8-9629-967A5777BAA8}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {F39D4179-3DEA-43E8-9629-967A5777BAA8}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {DE1A8100-7077-49D0-8E27-C8A6FCCA092A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {DE1A8100-7077-49D0-8E27-C8A6FCCA092A}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {DE1A8100-7077-49D0-8E27-C8A6FCCA092A}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {DE1A8100-7077-49D0-8E27-C8A6FCCA092A}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {A80C607D-5282-4DDF-9DEA-8B1B166651DB} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /TootNet/Connection.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using System.Net.Http; 3 | 4 | namespace TootNet 5 | { 6 | public class Connection 7 | { 8 | /// 9 | /// Gets or sets the value of the User-agent HTTP header. 10 | /// 11 | public string UserAgent { get; set; } = "TootNet"; 12 | 13 | /// 14 | /// Gets or sets a value that indicates whether the handler uses a proxy for requests. 15 | /// 16 | public bool UseProxy { get; set; } = true; 17 | 18 | /// 19 | /// Gets http client with user agent and access tokens. 20 | /// 21 | public HttpClient GetHttpClient(string accessToken = null, bool decompression = true) 22 | { 23 | var httpClientHandler = new HttpClientHandler 24 | { 25 | UseProxy = UseProxy, 26 | AutomaticDecompression = decompression ? DecompressionMethods.GZip : DecompressionMethods.None 27 | }; 28 | 29 | var httpClient = new HttpClient(httpClientHandler); 30 | httpClient.DefaultRequestHeaders.Add("User-Agent", UserAgent); 31 | if (!string.IsNullOrWhiteSpace(accessToken)) 32 | httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + accessToken); 33 | 34 | return httpClient; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /TootNet/Exception/MastodonException.cs: -------------------------------------------------------------------------------- 1 | using TootNet.Objects; 2 | 3 | namespace TootNet.Exception 4 | { 5 | public class MastodonException : System.Exception 6 | { 7 | public MastodonException(Error error) 8 | : base(error.ErrorMessage) 9 | { 10 | Error = error; 11 | } 12 | 13 | public Error Error { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /TootNet/Internal/ApiBase.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TootNet.Internal 3 | { 4 | public abstract class ApiBase 5 | { 6 | protected internal Tokens Tokens { get; set; } 7 | 8 | internal ApiBase(Tokens tokens) 9 | { 10 | Tokens = tokens; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /TootNet/Internal/Converter.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Newtonsoft.Json.Linq; 3 | using TootNet.Exception; 4 | using TootNet.Objects; 5 | 6 | namespace TootNet.Internal 7 | { 8 | internal static class Converter 9 | { 10 | public static T Convert(string json) where T : class 11 | { 12 | var parsed = JToken.Parse(json); 13 | if (parsed.Any(x => x is JProperty jp && jp.Name == "error")) 14 | { 15 | var error = parsed.ToObject(); 16 | error.RawJson = json; 17 | throw new MastodonException(error); 18 | } 19 | 20 | return parsed.ToObject(); 21 | } 22 | 23 | public static void ConvertError(string json) 24 | { 25 | var parsed = JToken.Parse(json); 26 | if (parsed.Any(x => x is JProperty jp && jp.Name == "error")) 27 | { 28 | var error = parsed.ToObject(); 29 | error.RawJson = json; 30 | throw new MastodonException(error); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /TootNet/Internal/TokensBase.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TootNet.Internal 3 | { 4 | public class TokensBase 5 | { 6 | internal TokensBase() 7 | { 8 | ConnectionOptions = new Connection(); 9 | ApiPath = "/api/"; 10 | } 11 | 12 | /// 13 | /// Gets or sets the options of the connection. 14 | /// 15 | public Connection ConnectionOptions { get; set; } 16 | 17 | /// 18 | /// Gets or sets the instance. 19 | /// 20 | public string Instance { get; set; } 21 | 22 | /// 23 | /// Gets or sets the api path. 24 | /// 25 | public string ApiPath { get; set; } 26 | 27 | /// 28 | /// Gets or sets the client id. 29 | /// 30 | public string ClientId { get; set; } 31 | 32 | /// 33 | /// Gets or sets the client secret. 34 | /// 35 | public string ClientSecret { get; set; } 36 | 37 | /// 38 | /// Gets or sets the access token. 39 | /// 40 | public string AccessToken { get; set; } 41 | 42 | protected string ConstructUri(string route, bool useApiPath = true, string apiVersion = "v1") 43 | { 44 | if (!useApiPath) 45 | return "https://" + Instance + "/" + route; 46 | 47 | return "https://" + Instance + ApiPath + apiVersion + "/" + route; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /TootNet/Internal/Utils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Linq.Expressions; 5 | using System.Net; 6 | 7 | namespace TootNet.Internal 8 | { 9 | internal static class Utils 10 | { 11 | internal static string CreateUrlParameter(string url, IEnumerable> param) 12 | { 13 | if (param == null || !param.Any()) 14 | return url; 15 | 16 | return url + "?" + string.Join("&", param.Select(kvp => kvp.Value is bool ? $"{kvp.Key}={kvp.Value.ToString().ToLower()}" : $"{kvp.Key}={WebUtility.UrlEncode(kvp.Value.ToString())}")); 17 | } 18 | 19 | internal static KeyValuePair GetReservedParameter(List> parameters, string reserved) 20 | { 21 | return parameters.Single(kvp => kvp.Key == reserved); 22 | } 23 | 24 | 25 | internal static object GetExpressionValue(Expression> expr) 26 | { 27 | return expr.Body is ConstantExpression constExpr ? constExpr.Value : expr.Compile()(""); 28 | } 29 | 30 | internal static IDictionary ExpressionToDictionary(Expression>[] parameters) 31 | { 32 | return parameters.Select(x => new KeyValuePair(x.Parameters[0].Name, GetExpressionValue(x))) 33 | .ToDictionary(x => x.Key, x => x.Value); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /TootNet/Objects/Account.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using TootNet.Internal; 5 | 6 | namespace TootNet.Objects 7 | { 8 | public class Account : BaseObject 9 | { 10 | [JsonProperty("id")] 11 | [JsonConverter(typeof(StringToLongConverter))] 12 | public long Id { get; set; } 13 | 14 | [JsonProperty("username")] 15 | public string UserName { get; set; } 16 | 17 | [JsonProperty("acct")] 18 | public string Acct { get; set; } 19 | 20 | [JsonProperty("url")] 21 | public string Url { get; set; } 22 | 23 | [JsonProperty("display_name")] 24 | public string DisplayName { get; set; } 25 | 26 | [JsonProperty("note")] 27 | public string Note { get; set; } 28 | 29 | [JsonProperty("avatar")] 30 | public string Avatar { get; set; } 31 | 32 | [JsonProperty("avatar_static")] 33 | public string AvatarStatic { get; set; } 34 | 35 | [JsonProperty("header")] 36 | public string Header { get; set; } 37 | 38 | [JsonProperty("header_static")] 39 | public string HeaderStatic { get; set; } 40 | 41 | [JsonProperty("locked")] 42 | public bool Locked { get; set; } 43 | 44 | [JsonProperty("fields")] 45 | public IEnumerable Fields { get; set; } 46 | 47 | [JsonProperty("emojis")] 48 | public IEnumerable Emojis { get; set; } 49 | 50 | [JsonProperty("bot")] 51 | public bool Bot { get; set; } 52 | 53 | [JsonProperty("group")] 54 | public bool Group { get; set; } 55 | 56 | [JsonProperty("discoverable")] 57 | public bool? Discoverable { get; set; } 58 | 59 | [JsonProperty("noindex")] 60 | public bool? Noindex { get; set; } 61 | 62 | [JsonProperty("moved")] 63 | public Account Moved { get; set; } 64 | 65 | [JsonProperty("suspended")] 66 | public bool? Suspended { get; set; } 67 | 68 | [JsonProperty("limited")] 69 | public bool? Limited { get; set; } 70 | 71 | [JsonProperty("created_at")] 72 | public DateTime CreatedAt { get; set; } 73 | 74 | [JsonProperty("last_status_at")] 75 | public DateTime? LastStatusAt { get; set; } 76 | 77 | [JsonProperty("statuses_count")] 78 | public int StatusesCount { get; set; } 79 | 80 | [JsonProperty("followers_count")] 81 | public int FollowersCount { get; set; } 82 | 83 | [JsonProperty("following_count")] 84 | public int FollowingCount { get; set; } 85 | 86 | [JsonProperty("mute_expires_at")] 87 | public DateTime? MuteExpiresAt { get; set; } 88 | } 89 | 90 | public class AccountField 91 | { 92 | [JsonProperty("name")] 93 | public string Name { get; set; } 94 | 95 | [JsonProperty("value")] 96 | public string Value { get; set; } 97 | 98 | [JsonProperty("verified_at")] 99 | public DateTime? VerifiedAt { get; set; } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /TootNet/Objects/Activity.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace TootNet.Objects 4 | { 5 | public class Activity : BaseObject 6 | { 7 | /// 8 | /// Unix timestamp 9 | /// 10 | [JsonProperty("week")] 11 | public long Week { get; set; } 12 | 13 | [JsonProperty("statuses")] 14 | public int Statuses { get; set; } 15 | 16 | [JsonProperty("logins")] 17 | public int Logins { get; set; } 18 | 19 | [JsonProperty("registrations")] 20 | public int Registrations { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /TootNet/Objects/Announcement.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using TootNet.Internal; 5 | 6 | namespace TootNet.Objects 7 | { 8 | public class Announcement : BaseObject 9 | { 10 | [JsonProperty("id")] 11 | [JsonConverter(typeof(StringToLongConverter))] 12 | public long Id { get; set; } 13 | 14 | [JsonProperty("content")] 15 | public string Content { get; set; } 16 | 17 | [JsonProperty("starts_at")] 18 | public DateTime? StartsAt { get; set; } 19 | 20 | [JsonProperty("ends_at")] 21 | public DateTime? EndsAt { get; set; } 22 | 23 | [JsonProperty("published")] 24 | public bool Published { get; set; } 25 | 26 | [JsonProperty("all_day")] 27 | public bool AllDay { get; set; } 28 | 29 | [JsonProperty("published_at")] 30 | public DateTime PublishedAt { get; set; } 31 | 32 | [JsonProperty("updated_at")] 33 | public DateTime UpdatedAt { get; set; } 34 | 35 | [JsonProperty("read")] 36 | public bool? Read { get; set; } 37 | 38 | [JsonProperty("mentions")] 39 | public IEnumerable Mentions { get; set; } 40 | 41 | [JsonProperty("statuses")] 42 | public IEnumerable Statuses { get; set; } 43 | 44 | [JsonProperty("tags")] 45 | public IEnumerable Tags { get; set; } 46 | 47 | [JsonProperty("emojis")] 48 | public IEnumerable Emojis { get; set; } 49 | 50 | [JsonProperty("reactions")] 51 | public IEnumerable Reactions { get; set; } 52 | } 53 | 54 | public class AnnouncementAccount 55 | { 56 | [JsonProperty("id")] 57 | [JsonConverter(typeof(StringToLongConverter))] 58 | public long Id { get; set; } 59 | 60 | [JsonProperty("username")] 61 | public string UserName { get; set; } 62 | 63 | [JsonProperty("url")] 64 | public string Url { get; set; } 65 | 66 | [JsonProperty("acct")] 67 | public string Acct { get; set; } 68 | } 69 | 70 | public class AnnouncementStatus 71 | { 72 | [JsonProperty("id")] 73 | [JsonConverter(typeof(StringToLongConverter))] 74 | public long Id { get; set; } 75 | 76 | [JsonProperty("url")] 77 | public string Url { get; set; } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /TootNet/Objects/Application.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace TootNet.Objects 4 | { 5 | public class Application : BaseObject 6 | { 7 | [JsonProperty("name")] 8 | public string Name { get; set; } 9 | 10 | [JsonProperty("website")] 11 | public string Website { get; set; } 12 | 13 | [JsonProperty("vapid_key")] 14 | public string VapidKey { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /TootNet/Objects/Base.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace TootNet.Objects 5 | { 6 | interface IBaseObject 7 | { 8 | string RawJson { get; set; } 9 | } 10 | 11 | interface ILinked 12 | { 13 | long? MaxId { get; set; } 14 | 15 | long? SinceId { get; set; } 16 | } 17 | 18 | public class BaseObject : IBaseObject 19 | { 20 | /// 21 | /// Gets or sets the raw json. 22 | /// 23 | [JsonIgnore] 24 | public string RawJson { get; set; } 25 | } 26 | 27 | /// 28 | /// Represents a list response object. 29 | /// 30 | public class ListResponse : List, IBaseObject 31 | { 32 | /// 33 | /// Gets or sets the raw json. 34 | /// 35 | [JsonIgnore] 36 | public string RawJson { get; set; } 37 | } 38 | 39 | /// 40 | /// Represents a linked message object. 41 | /// 42 | public class Linked : ListResponse, ILinked 43 | { 44 | /// 45 | /// Gets or sets the max id. 46 | /// 47 | [JsonIgnore] 48 | public long? MaxId { get; set; } 49 | 50 | /// 51 | /// Gets or sets the since id. 52 | /// 53 | [JsonIgnore] 54 | public long? SinceId { get; set; } 55 | } 56 | 57 | public class DictResponse : Dictionary, IBaseObject 58 | { 59 | /// 60 | /// Gets or sets the raw json. 61 | /// 62 | [JsonIgnore] 63 | public string RawJson { get; set; } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /TootNet/Objects/Context.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace TootNet.Objects 5 | { 6 | public class Context : BaseObject 7 | { 8 | [JsonProperty("ancestors")] 9 | public IEnumerable Ancestors { get; set; } 10 | 11 | [JsonProperty("descendants")] 12 | public IEnumerable Descendants { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /TootNet/Objects/Conversation.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | using TootNet.Internal; 4 | 5 | 6 | namespace TootNet.Objects 7 | { 8 | public class Conversation : BaseObject 9 | { 10 | [JsonProperty("id")] 11 | [JsonConverter(typeof(StringToLongConverter))] 12 | public long Id { get; set; } 13 | 14 | [JsonProperty("unread")] 15 | public bool Unread { get; set; } 16 | 17 | [JsonProperty("accounts")] 18 | public IEnumerable Accounts { get; set; } 19 | 20 | [JsonProperty("last_status")] 21 | public Status LastStatus { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /TootNet/Objects/CredentialAccount.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace TootNet.Objects 5 | { 6 | public class CredentialAccount : Account 7 | { 8 | [JsonProperty("source")] 9 | public CredentialAccountSource Source { get; set; } 10 | 11 | [JsonProperty("role")] 12 | public Role Role { get; set; } 13 | } 14 | 15 | 16 | public class CredentialAccountSource 17 | { 18 | [JsonProperty("note")] 19 | public string Note { get; set; } 20 | 21 | [JsonProperty("fields")] 22 | public IEnumerable Fields { get; set; } 23 | 24 | [JsonProperty("privacy")] 25 | public string Privacy { get; set; } 26 | 27 | [JsonProperty("sensitive")] 28 | public bool Sensitive { get; set; } 29 | 30 | [JsonProperty("language")] 31 | public string Language { get; set; } 32 | 33 | [JsonProperty("follow_requests_count")] 34 | public int FollowRequestsCount { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /TootNet/Objects/CustomEmoji.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace TootNet.Objects 4 | { 5 | public class CustomEmoji : BaseObject 6 | { 7 | [JsonProperty("shortcode")] 8 | public string Shortcode { get; set; } 9 | 10 | [JsonProperty("url")] 11 | public string Url { get; set; } 12 | 13 | [JsonProperty("static_url")] 14 | public string StaticUrl { get; set; } 15 | 16 | [JsonProperty("visible_in_picker")] 17 | public bool VisibleInPicker { get; set; } 18 | 19 | [JsonProperty("category")] 20 | public string Category { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /TootNet/Objects/DomainBlock.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace TootNet.Objects 4 | { 5 | public class DomainBlock : BaseObject 6 | { 7 | [JsonProperty("domain")] 8 | public string Domain { get; set; } 9 | 10 | [JsonProperty("digest")] 11 | public string Digest { get; set; } 12 | 13 | [JsonProperty("severity")] 14 | public string Severity { get; set; } 15 | 16 | [JsonProperty("comment")] 17 | public string Comment { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /TootNet/Objects/Error.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace TootNet.Objects 4 | { 5 | public class Error : BaseObject 6 | { 7 | [JsonProperty("error")] 8 | public string ErrorMessage { get; set; } 9 | 10 | [JsonProperty("error_description")] 11 | public string ErrorDescription { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /TootNet/Objects/ExtendedDescription.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | 4 | namespace TootNet.Objects 5 | { 6 | public class ExtendedDescription : BaseObject 7 | { 8 | [JsonProperty("updated_at")] 9 | public DateTime UpdatedAt { get; set; } 10 | 11 | [JsonProperty("content")] 12 | public string Content { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /TootNet/Objects/FamiliarFollower.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | using TootNet.Internal; 4 | 5 | namespace TootNet.Objects 6 | { 7 | public class FamiliarFollower : BaseObject 8 | { 9 | [JsonProperty("id")] 10 | [JsonConverter(typeof(StringToLongConverter))] 11 | public long Id { get; set; } 12 | 13 | [JsonProperty("accounts")] 14 | public IEnumerable Accounts { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /TootNet/Objects/FeaturedTag.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | 4 | namespace TootNet.Objects 5 | { 6 | public class FeaturedTag : BaseObject 7 | { 8 | [JsonProperty("id")] 9 | public long Id { get; set; } 10 | 11 | [JsonProperty("name")] 12 | public string Name { get; set; } 13 | 14 | [JsonProperty("url")] 15 | public string Url { get; set; } 16 | 17 | [JsonProperty("statuses_count")] 18 | public int StatusesCount { get; set; } 19 | 20 | [JsonProperty("last_status_at")] 21 | public DateTime? LastStatusAt { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /TootNet/Objects/Filter.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using TootNet.Internal; 5 | 6 | 7 | namespace TootNet.Objects 8 | { 9 | public class Filter : BaseObject 10 | { 11 | [JsonProperty("id")] 12 | [JsonConverter(typeof(StringToLongConverter))] 13 | public long Id { get; set; } 14 | 15 | [JsonProperty("title")] 16 | public string Title { get; set; } 17 | 18 | [JsonProperty("context")] 19 | public IEnumerable Context { get; set; } 20 | 21 | [JsonProperty("expires_at")] 22 | public DateTime? ExpiresAt { get; set; } 23 | 24 | [JsonProperty("filter_action")] 25 | public string FilterAction { get; set; } 26 | 27 | [JsonProperty("keywords")] 28 | public IEnumerable Keywords { get; set; } 29 | 30 | [JsonProperty("statuses")] 31 | public IEnumerable Statuses { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /TootNet/Objects/FilterKeyword.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using TootNet.Internal; 3 | 4 | 5 | namespace TootNet.Objects 6 | { 7 | public class FilterKeyword : BaseObject 8 | { 9 | [JsonProperty("id")] 10 | [JsonConverter(typeof(StringToLongConverter))] 11 | public long Id { get; set; } 12 | 13 | [JsonProperty("keyword")] 14 | public string Keyword { get; set; } 15 | 16 | [JsonProperty("whole_word")] 17 | public bool WholeWord { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /TootNet/Objects/FilterResult.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | using TootNet.Internal; 4 | 5 | 6 | namespace TootNet.Objects 7 | { 8 | public class FilterResult : BaseObject 9 | { 10 | [JsonProperty("filter")] 11 | public Filter Filter { get; set; } 12 | 13 | [JsonProperty("keyword_matches")] 14 | public IEnumerable KeywordMatches { get; set; } 15 | 16 | [JsonProperty("status_matches")] 17 | [JsonConverter(typeof(StringArrayToLongArrayConverter))] 18 | public IEnumerable StatusMatches { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /TootNet/Objects/FilterStatus.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using TootNet.Internal; 3 | 4 | 5 | namespace TootNet.Objects 6 | { 7 | public class FilterStatus : BaseObject 8 | { 9 | [JsonProperty("id")] 10 | [JsonConverter(typeof(StringToLongConverter))] 11 | public long Id { get; set; } 12 | 13 | [JsonProperty("status_id")] 14 | [JsonConverter(typeof(StringToLongConverter))] 15 | public long StatusId { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /TootNet/Objects/List.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using TootNet.Internal; 3 | 4 | namespace TootNet.Objects 5 | { 6 | public class List : BaseObject 7 | { 8 | [JsonProperty("id")] 9 | [JsonConverter(typeof(StringToLongConverter))] 10 | public long Id { get; set; } 11 | 12 | [JsonProperty("title")] 13 | public string Title { get; set; } 14 | 15 | [JsonProperty("replies_policy")] 16 | public string RepliesPolicy { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TootNet/Objects/Marker.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using TootNet.Internal; 4 | 5 | namespace TootNet.Objects 6 | { 7 | public class Marker : BaseObject 8 | { 9 | [JsonProperty("last_read_id")] 10 | [JsonConverter(typeof(StringToLongConverter))] 11 | public long LastReadId { get; set; } 12 | 13 | [JsonProperty("version")] 14 | public int Version { get; set; } 15 | 16 | [JsonProperty("updated_at")] 17 | public DateTime UpdatedAt { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /TootNet/Objects/Notification.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using TootNet.Internal; 4 | 5 | namespace TootNet.Objects 6 | { 7 | public class Notification : BaseObject 8 | { 9 | [JsonProperty("id")] 10 | [JsonConverter(typeof(StringToLongConverter))] 11 | public long Id { get; set; } 12 | 13 | [JsonProperty("type")] 14 | public string Type { get; set; } 15 | 16 | [JsonProperty("created_at")] 17 | public DateTime CreatedAt { get; set; } 18 | 19 | [JsonProperty("account")] 20 | public Account Account { get; set; } 21 | 22 | [JsonProperty("status")] 23 | public Status Status { get; set; } 24 | 25 | [JsonProperty("report")] 26 | public Report Report { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /TootNet/Objects/NotificationPolicy.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using TootNet.Internal; 4 | 5 | namespace TootNet.Objects 6 | { 7 | public class NotificationPolicy : BaseObject 8 | { 9 | [JsonProperty("for_not_following")] 10 | public string ForNotFollowing { get; set; } 11 | 12 | [JsonProperty("for_not_followers")] 13 | public string ForNotFollowers { get; set; } 14 | 15 | [JsonProperty("for_new_accounts")] 16 | public string ForNewAccounts { get; set; } 17 | 18 | [JsonProperty("for_private_mentions")] 19 | public string ForPrivateMentions { get; set; } 20 | 21 | [JsonProperty("for_limited_accounts")] 22 | public string ForLimitedAccounts { get; set; } 23 | 24 | [JsonProperty("summary")] 25 | public NotificationPolicySummary Summary { get; set; } 26 | } 27 | 28 | public class NotificationPolicySummary 29 | { 30 | [JsonProperty("pending_requests_count")] 31 | public int PendingRequestsCount { get; set; } 32 | 33 | [JsonProperty("pending_notifications_count")] 34 | public int PendingNotificationsCount { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /TootNet/Objects/NotificationRequest.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using TootNet.Internal; 4 | 5 | namespace TootNet.Objects 6 | { 7 | public class NotificationRequest : BaseObject 8 | { 9 | [JsonProperty("id")] 10 | [JsonConverter(typeof(StringToLongConverter))] 11 | public long Id { get; set; } 12 | 13 | [JsonProperty("created_at")] 14 | public DateTime CreatedAt { get; set; } 15 | 16 | [JsonProperty("updated_at")] 17 | public DateTime UpdatedAt { get; set; } 18 | 19 | [JsonProperty("account")] 20 | public Account Account { get; set; } 21 | 22 | [JsonProperty("notifications_count")] 23 | [JsonConverter(typeof(StringToIntConverter))] 24 | public int NotificationsCount { get; set; } 25 | 26 | [JsonProperty("last_status")] 27 | public Status LastStatus { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /TootNet/Objects/OEmbed.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace TootNet.Objects 4 | { 5 | public class OEmbed : BaseObject 6 | { 7 | [JsonProperty("type")] 8 | public string Type { get; set; } 9 | 10 | [JsonProperty("version")] 11 | public string Version { get; set; } 12 | 13 | [JsonProperty("title")] 14 | public string Title { get; set; } 15 | 16 | [JsonProperty("author_name")] 17 | public string AuthorName { get; set; } 18 | 19 | [JsonProperty("author_url")] 20 | public string AuthorUrl { get; set; } 21 | 22 | [JsonProperty("provider_name")] 23 | public string ProviderName { get; set; } 24 | 25 | [JsonProperty("provider_url")] 26 | public string ProviderUrl { get; set; } 27 | 28 | [JsonProperty("cache_age")] 29 | public int CacheAge { get; set; } 30 | 31 | [JsonProperty("html")] 32 | public string Html { get; set; } 33 | 34 | [JsonProperty("width")] 35 | public string Width { get; set; } 36 | 37 | [JsonProperty("height")] 38 | public string Height { get; set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /TootNet/Objects/Poll.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using TootNet.Internal; 5 | 6 | namespace TootNet.Objects 7 | { 8 | public class Poll : BaseObject 9 | { 10 | [JsonProperty("id")] 11 | [JsonConverter(typeof(StringToLongConverter))] 12 | public long Id { get; set; } 13 | 14 | [JsonProperty("expires_at")] 15 | public DateTime? ExpiresAt { get; set; } 16 | 17 | [JsonProperty("expired")] 18 | public bool Expired { get; set; } 19 | 20 | [JsonProperty("multiple")] 21 | public bool Multiple { get; set; } 22 | 23 | [JsonProperty("votes_count")] 24 | public int VotesCount { get; set; } 25 | 26 | [JsonProperty("voters_count")] 27 | public int? VotersCount { get; set; } 28 | 29 | [JsonProperty("options")] 30 | public IEnumerable Options { get; set; } 31 | 32 | [JsonProperty("emojis")] 33 | public IEnumerable Emojis { get; set; } 34 | 35 | [JsonProperty("voted")] 36 | public bool? Voted { get; set; } 37 | 38 | [JsonProperty("own_votes")] 39 | public IEnumerable OwnVotes { get; set; } 40 | } 41 | 42 | public class PollOption 43 | { 44 | [JsonProperty("title")] 45 | public string Title { get; set; } 46 | 47 | [JsonProperty("votes_count")] 48 | public int? VotesCount { get; set; } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /TootNet/Objects/PreviewCard.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace TootNet.Objects 4 | { 5 | public class PreviewCard : BaseObject 6 | { 7 | [JsonProperty("url")] 8 | public string Url { get; set; } 9 | 10 | [JsonProperty("title")] 11 | public string Title { get; set; } 12 | 13 | [JsonProperty("description")] 14 | public string Description { get; set; } 15 | 16 | [JsonProperty("type")] 17 | public string Type { get; set; } 18 | 19 | [JsonProperty("author_name")] 20 | public string AuthorName { get; set; } 21 | 22 | [JsonProperty("author_url")] 23 | public string AuthorUrl { get; set; } 24 | 25 | [JsonProperty("provider_name")] 26 | public string ProviderName { get; set; } 27 | 28 | [JsonProperty("provider_url")] 29 | public string ProviderUrl { get; set; } 30 | 31 | [JsonProperty("html")] 32 | public string Html { get; set; } 33 | 34 | [JsonProperty("width")] 35 | public int Width { get; set; } 36 | 37 | [JsonProperty("height")] 38 | public int Height { get; set; } 39 | 40 | [JsonProperty("image")] 41 | public string Image { get; set; } 42 | 43 | [JsonProperty("embed_url")] 44 | public string EmbedUrl { get; set; } 45 | 46 | [JsonProperty("blurhash")] 47 | public string Blurhash { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /TootNet/Objects/Reaction.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace TootNet.Objects 4 | { 5 | public class Reaction : BaseObject 6 | { 7 | [JsonProperty("name")] 8 | public string Name { get; set; } 9 | 10 | [JsonProperty("count")] 11 | public int Count { get; set; } 12 | 13 | [JsonProperty("me")] 14 | public bool? Me { get; set; } 15 | 16 | [JsonProperty("url")] 17 | public string Url { get; set; } 18 | 19 | [JsonProperty("static_url")] 20 | public string StaticUrl { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /TootNet/Objects/Relationship.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using TootNet.Internal; 5 | 6 | namespace TootNet.Objects 7 | { 8 | public class Relationship : BaseObject 9 | { 10 | [JsonProperty("id")] 11 | [JsonConverter(typeof(StringToLongConverter))] 12 | public long Id { get; set; } 13 | 14 | [JsonProperty("following")] 15 | public bool Following { get; set; } 16 | 17 | [JsonProperty("showing_reblogs")] 18 | public bool ShowingReblogs { get; set; } 19 | 20 | [JsonProperty("notifying")] 21 | public bool Notifying { get; set; } 22 | 23 | [JsonProperty("languages")] 24 | public IEnumerable Languages { get; set; } 25 | 26 | [JsonProperty("followed_by")] 27 | public bool FollowedBy { get; set; } 28 | 29 | [JsonProperty("blocking")] 30 | public bool Blocking { get; set; } 31 | 32 | [JsonProperty("blocked_by")] 33 | public bool BlockedBy { get; set; } 34 | 35 | [JsonProperty("muting")] 36 | public bool Muting { get; set; } 37 | 38 | [JsonProperty("muting_notifications")] 39 | [DefaultValue(false)] 40 | public bool MutingNotifications { get; set; } 41 | 42 | [JsonProperty("requested")] 43 | public bool Requested { get; set; } 44 | 45 | [JsonProperty("domain_blocking")] 46 | public bool DomainBlocking { get; set; } 47 | 48 | [JsonProperty("endorsed")] 49 | public bool Endorsed { get; set; } 50 | 51 | [JsonProperty("note")] 52 | public string Note { get; set; } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /TootNet/Objects/Report.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using TootNet.Internal; 5 | 6 | namespace TootNet.Objects 7 | { 8 | public class Report : BaseObject 9 | { 10 | [JsonProperty("id")] 11 | [JsonConverter(typeof(StringToLongConverter))] 12 | public long Id { get; set; } 13 | 14 | [JsonProperty("action_taken")] 15 | public bool ActionTaken { get; set; } 16 | 17 | [JsonProperty("action_taken_at")] 18 | public DateTime? ActionTakenAt { get; set; } 19 | 20 | [JsonProperty("category")] 21 | public string Category { get; set; } 22 | 23 | [JsonProperty("comment")] 24 | public string Comment { get; set; } 25 | 26 | [JsonProperty("forwarded")] 27 | public bool Forwarded { get; set; } 28 | 29 | [JsonProperty("created_at")] 30 | public DateTime CreatedAt { get; set; } 31 | 32 | [JsonProperty("status_ids")] 33 | [JsonConverter(typeof(StringArrayToLongArrayConverter))] 34 | public IEnumerable StatusIds { get; set; } 35 | 36 | [JsonProperty("rule_ids")] 37 | [JsonConverter(typeof(StringArrayToLongArrayConverter))] 38 | public IEnumerable RuleIds { get; set; } 39 | 40 | [JsonProperty("target_account")] 41 | public Account TargetAccount { get; set; } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /TootNet/Objects/Role.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using TootNet.Internal; 3 | 4 | namespace TootNet.Objects 5 | { 6 | public class Role : BaseObject 7 | { 8 | [JsonProperty("id")] 9 | [JsonConverter(typeof(StringToLongConverter))] 10 | public long Id { get; set; } 11 | 12 | [JsonProperty("name")] 13 | public string Name { get; set; } 14 | 15 | [JsonProperty("color")] 16 | public string Color { get; set; } 17 | 18 | [JsonProperty("permissions")] 19 | public int Permissions { get; set; } 20 | 21 | [JsonProperty("highlighted")] 22 | public bool Highlighted { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /TootNet/Objects/Rule.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using TootNet.Internal; 3 | 4 | namespace TootNet.Objects 5 | { 6 | public class Rule : BaseObject 7 | { 8 | [JsonProperty("id")] 9 | [JsonConverter(typeof(StringToLongConverter))] 10 | public long Id { get; set; } 11 | 12 | 13 | [JsonProperty("text")] 14 | public string Text { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /TootNet/Objects/ScheduledStatus.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using TootNet.Internal; 5 | 6 | namespace TootNet.Objects 7 | { 8 | public class ScheduledStatus : BaseObject 9 | { 10 | [JsonProperty("id")] 11 | [JsonConverter(typeof(StringToLongConverter))] 12 | public long Id { get; set; } 13 | 14 | [JsonProperty("scheduled_at")] 15 | public DateTime ScheduledAt { get; set; } 16 | 17 | [JsonProperty("params")] 18 | public ScheduledStatusParams Params { get; set; } 19 | 20 | [JsonProperty("media_attachments")] 21 | public IEnumerable MediaAttachments { get; set; } 22 | } 23 | 24 | public class ScheduledStatusParams 25 | { 26 | [JsonProperty("text")] 27 | public string Text { get; set; } 28 | 29 | [JsonProperty("poll")] 30 | public ScheduledStatusParamsPoll Poll { get; set; } 31 | 32 | [JsonProperty("media_ids")] 33 | [JsonConverter(typeof(StringArrayToLongArrayConverter))] 34 | public IEnumerable MediaIds { get; set; } 35 | 36 | [JsonProperty("sensitive")] 37 | public bool? Sensitive { get; set; } 38 | 39 | [JsonProperty("spoiler_text")] 40 | public string SpoilerText { get; set; } 41 | 42 | [JsonProperty("visibility")] 43 | public string Visibility { get; set; } 44 | 45 | [JsonProperty("in_reply_to_id")] 46 | [JsonConverter(typeof(StringToLongConverter))] 47 | public long? InReplyToId { get; set; } 48 | 49 | [JsonProperty("language")] 50 | public string Language { get; set; } 51 | 52 | [JsonProperty("application_id")] 53 | [JsonConverter(typeof(StringToLongConverter))] 54 | public long ApplicationId { get; set; } 55 | 56 | [JsonProperty("scheduled_at")] 57 | public DateTime? ScheduledAt { get; set; } 58 | 59 | [JsonProperty("idempotency")] 60 | public string Idempotency { get; set; } 61 | 62 | [JsonProperty("with_rate_limit")] 63 | public bool WithRateLimit { get; set; } 64 | } 65 | 66 | public class ScheduledStatusParamsPoll 67 | { 68 | [JsonProperty("options")] 69 | public IEnumerable Options { get; set; } 70 | 71 | [JsonProperty("expires_in")] 72 | public int ExpiresIn { get; set; } 73 | 74 | [JsonProperty("multiple")] 75 | public bool? Multiple { get; set; } 76 | 77 | [JsonProperty("hide_totals")] 78 | public bool? HideTotals { get; set; } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /TootNet/Objects/Search.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace TootNet.Objects 5 | { 6 | public class Search : BaseObject 7 | { 8 | [JsonProperty("accounts")] 9 | public IEnumerable Accounts { get; set; } 10 | 11 | [JsonProperty("statuses")] 12 | public IEnumerable Statuses { get; set; } 13 | 14 | [JsonProperty("hashtags")] 15 | public IEnumerable Hashtags { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /TootNet/Objects/Status.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using TootNet.Internal; 5 | 6 | namespace TootNet.Objects 7 | { 8 | public class Status : BaseObject 9 | { 10 | [JsonProperty("id")] 11 | [JsonConverter(typeof(StringToLongConverter))] 12 | public long Id { get; set; } 13 | 14 | [JsonProperty("uri")] 15 | public string Uri { get; set; } 16 | 17 | [JsonProperty("created_at")] 18 | public DateTime CreatedAt { get; set; } 19 | 20 | [JsonProperty("account")] 21 | public Account Account { get; set; } 22 | 23 | [JsonProperty("content")] 24 | public string Content { get; set; } 25 | 26 | [JsonProperty("visibility")] 27 | public string Visibility { get; set; } 28 | 29 | [JsonProperty("sensitive")] 30 | public bool Sensitive { get; set; } 31 | 32 | [JsonProperty("spoiler_text")] 33 | public string SpoilerText { get; set; } 34 | 35 | [JsonProperty("media_attachments")] 36 | public IEnumerable MediaAttachments { get; set; } 37 | 38 | [JsonProperty("application")] 39 | public Application Application { get; set; } 40 | 41 | [JsonProperty("mentions")] 42 | public IEnumerable Mentions { get; set; } 43 | 44 | [JsonProperty("tags")] 45 | public IEnumerable Tags { get; set; } 46 | 47 | [JsonProperty("emojis")] 48 | public IEnumerable Emojis { get; set; } 49 | 50 | [JsonProperty("reblogs_count")] 51 | public int ReblogsCount { get; set; } 52 | 53 | [JsonProperty("favourites_count")] 54 | public int FavouritesCount { get; set; } 55 | 56 | [JsonProperty("replies_count")] 57 | public int RepliesCount { get; set; } 58 | 59 | [JsonProperty("url")] 60 | public string Url { get; set; } 61 | 62 | [JsonProperty("in_reply_to_id")] 63 | [JsonConverter(typeof(StringToLongConverter))] 64 | public long? InReplyToId { get; set; } 65 | 66 | [JsonProperty("in_reply_to_account_id")] 67 | [JsonConverter(typeof(StringToLongConverter))] 68 | public long? InReplyToAccountId { get; set; } 69 | 70 | [JsonProperty("reblog")] 71 | public Status Reblog { get; set; } 72 | 73 | [JsonProperty("poll")] 74 | public Poll Poll { get; set; } 75 | 76 | [JsonProperty("card")] 77 | public PreviewCard Card { get; set; } 78 | 79 | [JsonProperty("language")] 80 | public string Language { get; set; } 81 | 82 | [JsonProperty("text")] 83 | public string Text { get; set; } 84 | 85 | [JsonProperty("edited_at")] 86 | public DateTime? EditiedAt { get; set; } 87 | 88 | [JsonProperty("favourited")] 89 | public bool? Favourited { get; set; } 90 | 91 | [JsonProperty("reblogged")] 92 | public bool? Reblogged { get; set; } 93 | 94 | [JsonProperty("muted")] 95 | public bool? Muted { get; set; } 96 | 97 | [JsonProperty("bookmarked")] 98 | public bool? Bookmarked { get; set; } 99 | 100 | [JsonProperty("pinned")] 101 | public bool? Pinned { get; set; } 102 | 103 | [JsonProperty("filtered")] 104 | public IEnumerable Filtered { get; set; } 105 | } 106 | 107 | public class StatusMention 108 | { 109 | [JsonProperty("id")] 110 | [JsonConverter(typeof(StringToLongConverter))] 111 | public long Id { get; set; } 112 | 113 | [JsonProperty("username")] 114 | public string UserName { get; set; } 115 | 116 | [JsonProperty("url")] 117 | public string Url { get; set; } 118 | 119 | [JsonProperty("acct")] 120 | public string Acct { get; set; } 121 | } 122 | 123 | public class StatusTag 124 | { 125 | [JsonProperty("name")] 126 | public string Name { get; set; } 127 | 128 | [JsonProperty("url")] 129 | public string Url { get; set; } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /TootNet/Objects/StatusEdit.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace TootNet.Objects 6 | { 7 | public class StatusEdit : BaseObject 8 | { 9 | [JsonProperty("content")] 10 | public string Content { get; set; } 11 | 12 | [JsonProperty("spoiler_text")] 13 | public string SpoilerText { get; set; } 14 | 15 | [JsonProperty("sensitive")] 16 | public bool Sensitive { get; set; } 17 | 18 | [JsonProperty("created_at")] 19 | public DateTime CreatedAt { get; set; } 20 | 21 | [JsonProperty("account")] 22 | public Account Account { get; set; } 23 | 24 | [JsonProperty("poll")] 25 | public StatusEditPoll Poll { get; set; } 26 | 27 | [JsonProperty("media_attachments")] 28 | public IEnumerable MediaAttachments { get; set; } 29 | 30 | [JsonProperty("emojis")] 31 | public IEnumerable Emojis { get; set; } 32 | } 33 | 34 | public class StatusEditPoll 35 | { 36 | [JsonProperty("options")] 37 | public IEnumerable Options { get; set; } 38 | } 39 | 40 | public class StatusEditPollOption 41 | { 42 | [JsonProperty("title")] 43 | public string Title { get; set; } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /TootNet/Objects/StatusSource.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using TootNet.Internal; 3 | 4 | namespace TootNet.Objects 5 | { 6 | public class StatusSource : BaseObject 7 | { 8 | [JsonProperty("id")] 9 | [JsonConverter(typeof(StringToLongConverter))] 10 | public long Id { get; set; } 11 | 12 | [JsonProperty("text")] 13 | public string Text { get; set; } 14 | 15 | [JsonProperty("spoiler_text")] 16 | public string SpoilerText { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TootNet/Objects/Suggestion.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace TootNet.Objects 5 | { 6 | public class Suggestion : BaseObject 7 | { 8 | [JsonProperty("source")] 9 | public IEnumerable Source { get; set; } 10 | 11 | [JsonProperty("account")] 12 | public Account Account { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /TootNet/Objects/Tag.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace TootNet.Objects 5 | { 6 | public class Tag : BaseObject 7 | { 8 | [JsonProperty("name")] 9 | public string Name { get; set; } 10 | 11 | [JsonProperty("url")] 12 | public string Url { get; set; } 13 | 14 | [JsonProperty("history")] 15 | public IEnumerable History { get; set; } 16 | 17 | [JsonProperty("following")] 18 | public bool? Following { get; set; } 19 | } 20 | 21 | public class TagHistory 22 | { 23 | /// 24 | /// Unix timestamp 25 | /// 26 | [JsonProperty("day")] 27 | public long Day { get; set; } 28 | 29 | [JsonProperty("uses")] 30 | public int Uses { get; set; } 31 | 32 | [JsonProperty("accounts")] 33 | public int Accounts { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /TootNet/Objects/Token.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace TootNet.Objects 4 | { 5 | public class Token : BaseObject 6 | { 7 | [JsonProperty("access_token")] 8 | public string AccessToken { get; set; } 9 | 10 | [JsonProperty("token_type")] 11 | public string TokenType { get; set; } 12 | 13 | [JsonProperty("scope")] 14 | public string Scope { get; set; } 15 | 16 | /// 17 | /// Unix timestamp 18 | /// 19 | [JsonProperty("created_at")] 20 | public long CreatedAt { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /TootNet/Objects/Translation.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace TootNet.Objects 4 | { 5 | public class Translation : BaseObject 6 | { 7 | [JsonProperty("content")] 8 | public string Content { get; set; } 9 | 10 | [JsonProperty("detected_source_language")] 11 | public string DetectedSourceLanguage { get; set; } 12 | 13 | [JsonProperty("provider")] 14 | public string Provider { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /TootNet/Objects/TrendsLink.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace TootNet.Objects 5 | { 6 | public class TrendsLink : PreviewCard 7 | { 8 | [JsonProperty("history")] 9 | public IEnumerable History { get; set; } 10 | } 11 | 12 | public class TrendsLinkHistory 13 | { 14 | /// 15 | /// Unix timestamp 16 | /// 17 | [JsonProperty("day")] 18 | public long Day { get; set; } 19 | 20 | [JsonProperty("uses")] 21 | public int Uses { get; set; } 22 | 23 | [JsonProperty("accounts")] 24 | public int Accounts { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /TootNet/Rest/Apps.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Apps : ApiBase 13 | { 14 | internal Apps(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// Verify your app works. 18 | /// Available parameters: 19 | /// - No parameters available in this method. 20 | /// 21 | /// The parameters. 22 | /// 23 | /// The task object representing the asynchronous operation. 24 | /// The Result property on the task object returns the application object. 25 | /// 26 | public Task VerifyCredentialsAsync(params Expression>[] parameters) 27 | { 28 | return Tokens.AccessApiAsync(MethodType.Get, "apps/verify_credentials", Utils.ExpressionToDictionary(parameters)); 29 | } 30 | 31 | /// 32 | public Task VerifyCredentialsAsync(IDictionary parameters) 33 | { 34 | return Tokens.AccessApiAsync(MethodType.Get, "apps/verify_credentials", parameters); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /TootNet/Rest/Blocks.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Blocks : ApiBase 13 | { 14 | internal Blocks(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// View blocked users. 18 | /// Available parameters: 19 | /// - long max_id (optional) 20 | /// - long since_id (optional) 21 | /// - long min_id (optional) 22 | /// - int limit (optional) 23 | /// 24 | /// The parameters. 25 | /// 26 | /// The task object representing the asynchronous operation. 27 | /// The Result property on the task object returns the list of account object. 28 | /// 29 | public Task> GetAsync(params Expression>[] parameters) 30 | { 31 | return Tokens.AccessApiAsync>(MethodType.Get, "blocks", Utils.ExpressionToDictionary(parameters)); 32 | } 33 | 34 | /// 35 | public Task> GetAsync(IDictionary parameters) 36 | { 37 | return Tokens.AccessApiAsync>(MethodType.Get, "blocks", parameters); 38 | } 39 | 40 | /// 41 | /// Block account. 42 | /// Available parameters: 43 | /// - long id (required) 44 | /// 45 | /// The parameters. 46 | /// 47 | /// The task object representing the asynchronous operation. 48 | /// The Result property on the task object returns the relationship object. 49 | /// 50 | public Task BlockAsync(params Expression>[] parameters) 51 | { 52 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "accounts/{id}/block", "id", Utils.ExpressionToDictionary(parameters)); 53 | } 54 | 55 | /// 56 | public Task BlockAsync(IDictionary parameters) 57 | { 58 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "accounts/{id}/block", "id", parameters); 59 | } 60 | 61 | /// 62 | /// Unblock account. 63 | /// Available parameters: 64 | /// - long id (required) 65 | /// 66 | /// The parameters. 67 | /// 68 | /// The task object representing the asynchronous operation. 69 | /// The Result property on the task object returns the relationship object. 70 | /// 71 | public Task UnblockAsync(params Expression>[] parameters) 72 | { 73 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "accounts/{id}/unblock", "id", Utils.ExpressionToDictionary(parameters)); 74 | } 75 | 76 | /// 77 | public Task UnblockAsync(IDictionary parameters) 78 | { 79 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "accounts/{id}/unblock", "id", parameters); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /TootNet/Rest/Bookmarks.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Bookmarks : ApiBase 13 | { 14 | internal Bookmarks(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// View bookmarked statuses. 18 | /// Available parameters: 19 | /// - long max_id (optional) 20 | /// - long since_id (optional) 21 | /// - long min_id (optional) 22 | /// - int limit (optional) 23 | /// 24 | /// The parameters. 25 | /// 26 | /// The task object representing the asynchronous operation. 27 | /// The Result property on the task object returns the list of status object. 28 | /// 29 | public Task> GetAsync(params Expression>[] parameters) 30 | { 31 | return Tokens.AccessApiAsync>(MethodType.Get, "bookmarks", Utils.ExpressionToDictionary(parameters)); 32 | } 33 | 34 | /// 35 | public Task> GetAsync(IDictionary parameters) 36 | { 37 | return Tokens.AccessApiAsync>(MethodType.Get, "bookmarks", parameters); 38 | } 39 | 40 | /// 41 | /// Bookmark a status. 42 | /// Available parameters: 43 | /// - long id (required) 44 | /// 45 | /// The parameters. 46 | /// 47 | /// The task object representing the asynchronous operation. 48 | /// The Result property on the task object returns the status object. 49 | /// 50 | public Task BookmarkAsync(params Expression>[] parameters) 51 | { 52 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "statuses/{id}/bookmark", "id", Utils.ExpressionToDictionary(parameters)); 53 | } 54 | 55 | /// 56 | public Task BookmarkAsync(IDictionary parameters) 57 | { 58 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "statuses/{id}/bookmark", "id", parameters); 59 | } 60 | 61 | /// 62 | /// Undo bookmark of a status. 63 | /// Available parameters: 64 | /// - long id (required) 65 | /// 66 | /// The parameters. 67 | /// 68 | /// The task object representing the asynchronous operation. 69 | /// The Result property on the task object returns the status object. 70 | /// 71 | public Task UnbookmarkAsync(params Expression>[] parameters) 72 | { 73 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "statuses/{id}/unbookmark", "id", Utils.ExpressionToDictionary(parameters)); 74 | } 75 | 76 | /// 77 | public Task UnbookmarkAsync(IDictionary parameters) 78 | { 79 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "statuses/{id}/unbookmark", "id", parameters); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /TootNet/Rest/Conversations.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Conversations : ApiBase 13 | { 14 | internal Conversations(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// View all conversations. 18 | /// Available parameters: 19 | /// - long max_id (optional) 20 | /// - long since_id (optional) 21 | /// - long min_id (optional) 22 | /// - int limit (optional) 23 | /// 24 | /// The parameters. 25 | /// 26 | /// The task object representing the asynchronous operation. 27 | /// The Result property on the task object returns the list of conversation object. 28 | /// 29 | public Task> GetAsync(params Expression>[] parameters) 30 | { 31 | return Tokens.AccessApiAsync>(MethodType.Get, "conversations", Utils.ExpressionToDictionary(parameters)); 32 | } 33 | 34 | /// 35 | public Task> GetAsync(IDictionary parameters) 36 | { 37 | return Tokens.AccessApiAsync>(MethodType.Get, "conversations", parameters); 38 | } 39 | 40 | /// 41 | /// Remove a conversation. 42 | /// Available parameters: 43 | /// - long id (required) 44 | /// 45 | /// The parameters. 46 | /// 47 | /// The task object representing the asynchronous operation. 48 | /// The Result property on the task object returns the empty object. 49 | /// 50 | public Task DeleteAsync(params Expression>[] parameters) 51 | { 52 | return Tokens.AccessParameterReservedApiAsync(MethodType.Delete, "conversations/{id}", "id", Utils.ExpressionToDictionary(parameters)); 53 | } 54 | 55 | /// 56 | public Task DeleteAsync(IDictionary parameters) 57 | { 58 | return Tokens.AccessParameterReservedApiAsync(MethodType.Delete, "conversations/{id}", "id", parameters); 59 | } 60 | 61 | /// 62 | /// Mark a conversation as read. 63 | /// Available parameters: 64 | /// - long id (required) 65 | /// 66 | /// The parameters. 67 | /// 68 | /// The task object representing the asynchronous operation. 69 | /// The Result property on the task object returns the conversation object. 70 | /// 71 | public Task ReadAsync(params Expression>[] parameters) 72 | { 73 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "conversations/{id}/read", "id", Utils.ExpressionToDictionary(parameters)); 74 | } 75 | 76 | /// 77 | public Task ReadAsync(IDictionary parameters) 78 | { 79 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "conversations/{id}/read", "id", parameters); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /TootNet/Rest/CustomEmojis.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class CustomEmojis : ApiBase 13 | { 14 | internal CustomEmojis(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// View all custom emoji. 18 | /// Available parameters: 19 | /// - No parameters available in this method. 20 | /// 21 | /// The parameters. 22 | /// 23 | /// The task object representing the asynchronous operation. 24 | /// The Result property on the task object returns the list of customemoji object. 25 | /// 26 | public Task> GetAsync(params Expression>[] parameters) 27 | { 28 | return Tokens.AccessApiAsync>(MethodType.Get, "custom_emojis", Utils.ExpressionToDictionary(parameters)); 29 | } 30 | 31 | /// 32 | public Task> GetAsync(IDictionary parameters) 33 | { 34 | return Tokens.AccessApiAsync>(MethodType.Get, "custom_emojis", parameters); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /TootNet/Rest/Directory.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Directory : ApiBase 13 | { 14 | internal Directory(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// View profile directory. 18 | /// Available parameters: 19 | /// - int offset (optional) 20 | /// - int limit (optional) 21 | /// - string order (optional) 22 | /// - bool local (optional) 23 | /// 24 | /// The parameters. 25 | /// 26 | /// The task object representing the asynchronous operation. 27 | /// The Result property on the task object returns the list of account object. 28 | /// 29 | public Task> GetAsync(params Expression>[] parameters) 30 | { 31 | return Tokens.AccessApiAsync>(MethodType.Get, "directory", Utils.ExpressionToDictionary(parameters)); 32 | } 33 | 34 | /// 35 | public Task> GetAsync(IDictionary parameters) 36 | { 37 | return Tokens.AccessApiAsync>(MethodType.Get, "directory", parameters); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /TootNet/Rest/DomainBlocks.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class DomainBlocks : ApiBase 13 | { 14 | internal DomainBlocks(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// Get domain blocks. 18 | /// Available parameters: 19 | /// - long max_id (optional) 20 | /// - long since_id (optional) 21 | /// - long min_id (optional) 22 | /// - int limit (optional) 23 | /// 24 | /// The parameters. 25 | /// 26 | /// The task object representing the asynchronous operation. 27 | /// The Result property on the task object returns the list of string object. 28 | /// 29 | public Task> GetAsync(params Expression>[] parameters) 30 | { 31 | return Tokens.AccessApiAsync>(MethodType.Get, "domain_blocks", Utils.ExpressionToDictionary(parameters)); 32 | } 33 | 34 | /// 35 | public Task> GetAsync(IDictionary parameters) 36 | { 37 | return Tokens.AccessApiAsync>(MethodType.Get, "domain_blocks", parameters); 38 | } 39 | 40 | /// 41 | /// Block a domain. 42 | /// Available parameters: 43 | /// - string domain (required) 44 | /// 45 | /// The parameters. 46 | /// 47 | /// The task object representing the asynchronous operation. 48 | /// The Result property on the task object returns the empty object. 49 | /// 50 | public Task PostAsync(params Expression>[] parameters) 51 | { 52 | return Tokens.AccessApiAsync(MethodType.Post, "domain_blocks", Utils.ExpressionToDictionary(parameters)); 53 | } 54 | 55 | /// 56 | public Task PostAsync(IDictionary parameters) 57 | { 58 | return Tokens.AccessApiAsync(MethodType.Post, "domain_blocks", parameters); 59 | } 60 | 61 | /// 62 | /// Unblock a domain. 63 | /// Available parameters: 64 | /// - string domain (required) 65 | /// 66 | /// The parameters. 67 | /// 68 | /// The task object representing the asynchronous operation. 69 | /// The Result property on the task object returns the empty object. 70 | /// 71 | public Task DeleteAsync(params Expression>[] parameters) 72 | { 73 | return Tokens.AccessApiAsync(MethodType.Delete, "domain_blocks", Utils.ExpressionToDictionary(parameters)); 74 | } 75 | 76 | /// 77 | public Task DeleteAsync(IDictionary parameters) 78 | { 79 | return Tokens.AccessApiAsync(MethodType.Delete, "domain_blocks", parameters); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /TootNet/Rest/Endorsements.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Endorsements : ApiBase 13 | { 14 | internal Endorsements(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// View currently featured profiles. 18 | /// Available parameters: 19 | /// - long max_id (optional) 20 | /// - long since_id (optional) 21 | /// - int limit (optional) 22 | /// 23 | /// The parameters. 24 | /// 25 | /// The task object representing the asynchronous operation. 26 | /// The Result property on the task object returns the list of account object. 27 | /// 28 | public Task> GetAsync(params Expression>[] parameters) 29 | { 30 | return Tokens.AccessApiAsync>(MethodType.Get, "endorsements", Utils.ExpressionToDictionary(parameters)); 31 | } 32 | 33 | /// 34 | public Task> GetAsync(IDictionary parameters) 35 | { 36 | return Tokens.AccessApiAsync>(MethodType.Get, "endorsements", parameters); 37 | } 38 | 39 | /// 40 | /// Feature account on your profile. 41 | /// Available parameters: 42 | /// - long id (required) 43 | /// 44 | /// The parameters. 45 | /// 46 | /// The task object representing the asynchronous operation. 47 | /// The Result property on the task object returns the relationship object. 48 | /// 49 | public Task PinAsync(params Expression>[] parameters) 50 | { 51 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "accounts/{id}/pin", "id", Utils.ExpressionToDictionary(parameters)); 52 | } 53 | 54 | /// 55 | public Task PinAsync(IDictionary parameters) 56 | { 57 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "accounts/{id}/pin", "id", parameters); 58 | } 59 | 60 | /// 61 | /// Unfeature account from profile. 62 | /// Available parameters: 63 | /// - long id (required) 64 | /// 65 | /// The parameters. 66 | /// 67 | /// The task object representing the asynchronous operation. 68 | /// The Result property on the task object returns the relationship object. 69 | /// 70 | public Task UnpinAsync(params Expression>[] parameters) 71 | { 72 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "accounts/{id}/unpin", "id", Utils.ExpressionToDictionary(parameters)); 73 | } 74 | 75 | /// 76 | public Task UnpinAsync(IDictionary parameters) 77 | { 78 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "accounts/{id}/unpin", "id", parameters); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /TootNet/Rest/Favourites.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Favourites : ApiBase 13 | { 14 | internal Favourites(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// View favourited statuses. 18 | /// Available parameters: 19 | /// - long max_id (optional) 20 | /// - long since_id (optional) 21 | /// - long min_id (optional) 22 | /// - int limit (optional) 23 | /// 24 | /// The parameters. 25 | /// 26 | /// The task object representing the asynchronous operation. 27 | /// The Result property on the task object returns the list of status object. 28 | /// 29 | public Task> GetAsync(params Expression>[] parameters) 30 | { 31 | return Tokens.AccessApiAsync>(MethodType.Get, "favourites", Utils.ExpressionToDictionary(parameters)); 32 | } 33 | 34 | /// 35 | public Task> GetAsync(IDictionary parameters) 36 | { 37 | return Tokens.AccessApiAsync>(MethodType.Get, "favourites", parameters); 38 | } 39 | 40 | /// 41 | /// Favourite a status. 42 | /// Available parameters: 43 | /// - long id (required) 44 | /// 45 | /// The parameters. 46 | /// 47 | /// The task object representing the asynchronous operation. 48 | /// The Result property on the task object returns the status object. 49 | /// 50 | public Task FavouriteAsync(params Expression>[] parameters) 51 | { 52 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "statuses/{id}/favourite", "id", Utils.ExpressionToDictionary(parameters)); 53 | } 54 | 55 | /// 56 | public Task FavouriteAsync(IDictionary parameters) 57 | { 58 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "statuses/{id}/favourite", "id", parameters); 59 | } 60 | 61 | /// 62 | /// Undo favourite of a status. 63 | /// Available parameters: 64 | /// - long id (required) 65 | /// 66 | /// The parameters. 67 | /// 68 | /// The task object representing the asynchronous operation. 69 | /// The Result property on the task object returns the status object. 70 | /// 71 | public Task UnfavouriteAsync(params Expression>[] parameters) 72 | { 73 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "statuses/{id}/unfavourite", "id", Utils.ExpressionToDictionary(parameters)); 74 | } 75 | 76 | /// 77 | public Task UnfavouriteAsync(IDictionary parameters) 78 | { 79 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "statuses/{id}/unfavourite", "id", parameters); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /TootNet/Rest/FollowRequests.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class FollowRequests : ApiBase 13 | { 14 | internal FollowRequests(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// View pending follow requests. 18 | /// Available parameters: 19 | /// - long max_id (optional) 20 | /// - long since_id (optional) 21 | /// - int limit (optional) 22 | /// 23 | /// The parameters. 24 | /// 25 | /// The task object representing the asynchronous operation. 26 | /// The Result property on the task object returns the list of account object. 27 | /// 28 | public Task> GetAsync(params Expression>[] parameters) 29 | { 30 | return Tokens.AccessApiAsync>(MethodType.Get, "follow_requests", Utils.ExpressionToDictionary(parameters)); 31 | } 32 | 33 | /// 34 | public Task> GetAsync(IDictionary parameters) 35 | { 36 | return Tokens.AccessApiAsync>(MethodType.Get, "follow_requests", parameters); 37 | } 38 | 39 | /// 40 | /// Accept follow request. 41 | /// Available parameters: 42 | /// - long account_id (required) 43 | /// 44 | /// The parameters. 45 | /// 46 | /// The task object representing the asynchronous operation. 47 | /// The Result property on the task object returns the relationship object. 48 | /// 49 | public Task AuthorizeAsync(params Expression>[] parameters) 50 | { 51 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "follow_requests/{account_id}/authorize", "account_id", Utils.ExpressionToDictionary(parameters)); 52 | } 53 | 54 | /// 55 | public Task AuthorizeAsync(IDictionary parameters) 56 | { 57 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "follow_requests/{account_id}/authorize", "account_id", parameters); 58 | } 59 | 60 | /// 61 | /// Reject follow request. 62 | /// Available parameters: 63 | /// - long account_id (required) 64 | /// 65 | /// The parameters. 66 | /// 67 | /// The task object representing the asynchronous operation. 68 | /// The Result property on the task object returns the relationship object. 69 | /// 70 | public Task RejectAsync(params Expression>[] parameters) 71 | { 72 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "follow_requests/{account_id}/reject", "account_id", Utils.ExpressionToDictionary(parameters)); 73 | } 74 | 75 | /// 76 | public Task RejectAsync(IDictionary parameters) 77 | { 78 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "follow_requests/{account_id}/reject", "account_id", parameters); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /TootNet/Rest/Markers.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Markers : ApiBase 13 | { 14 | internal Markers(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// Get saved timeline positions. 18 | /// Available parameters: 19 | /// - IEnumerable<string> timeline (allowed values: "home", "notifications") (optional) 20 | /// 21 | /// The parameters. 22 | /// 23 | /// The task object representing the asynchronous operation. 24 | /// The Result property on the task object returns the dict string,marker object. 25 | /// 26 | public Task> GetAsync(params Expression>[] parameters) 27 | { 28 | return Tokens.AccessApiAsync>(MethodType.Get, "markers", Utils.ExpressionToDictionary(parameters)); 29 | } 30 | 31 | /// 32 | public Task> GetAsync(IDictionary parameters) 33 | { 34 | return Tokens.AccessApiAsync>(MethodType.Get, "markers", parameters); 35 | } 36 | 37 | /// 38 | /// Save your position in a timeline. 39 | /// Available parameters: 40 | /// - long home[last_read_id] (optional) 41 | /// - long notifications[last_read_id] (optional) 42 | /// 43 | /// The parameters. 44 | /// 45 | /// The task object representing the asynchronous operation. 46 | /// The Result property on the task object returns the dict string,marker object. 47 | /// 48 | public Task> PostAsync(params Expression>[] parameters) 49 | { 50 | return Tokens.AccessApiAsync>(MethodType.Post, "markers", Utils.ExpressionToDictionary(parameters)); 51 | } 52 | 53 | /// 54 | public Task> PostAsync(IDictionary parameters) 55 | { 56 | return Tokens.AccessApiAsync>(MethodType.Post, "markers", parameters); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /TootNet/Rest/Media.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Media : ApiBase 13 | { 14 | internal Media(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// Upload media as an attachment (async). 18 | /// Available parameters: 19 | /// - object file (required) 20 | /// - object thumbnail (optional) 21 | /// - string description (optional) 22 | /// - string focus (optional) 23 | /// 24 | /// The parameters. 25 | /// 26 | /// The task object representing the asynchronous operation. 27 | /// The Result property on the task object returns the mediaattachment object. 28 | /// 29 | public Task PostAsync(params Expression>[] parameters) 30 | { 31 | return Tokens.AccessApiAsync(MethodType.Post, "media", Utils.ExpressionToDictionary(parameters), apiVersion: "v2"); 32 | } 33 | 34 | /// 35 | public Task PostAsync(IDictionary parameters) 36 | { 37 | return Tokens.AccessApiAsync(MethodType.Post, "media", parameters, apiVersion: "v2"); 38 | } 39 | 40 | /// 41 | /// Get media attachment. 42 | /// Available parameters: 43 | /// - long id (required) 44 | /// 45 | /// The parameters. 46 | /// 47 | /// The task object representing the asynchronous operation. 48 | /// The Result property on the task object returns the mediaattachment object. 49 | /// 50 | public Task IdAsync(params Expression>[] parameters) 51 | { 52 | return Tokens.AccessParameterReservedApiAsync(MethodType.Get, "media/{id}", "id", Utils.ExpressionToDictionary(parameters)); 53 | } 54 | 55 | /// 56 | public Task IdAsync(IDictionary parameters) 57 | { 58 | return Tokens.AccessParameterReservedApiAsync(MethodType.Get, "media/{id}", "id", parameters); 59 | } 60 | 61 | /// 62 | /// Update media attachment. 63 | /// Available parameters: 64 | /// - long id (required) 65 | /// - object thumbnail (optional) 66 | /// - string description (optional) 67 | /// - string focus (focal point: two floating points, comma-delimited) (optional) 68 | /// 69 | /// The parameters. 70 | /// 71 | /// The task object representing the asynchronous operation. 72 | /// The Result property on the task object returns the mediaattachment object. 73 | /// 74 | public Task PutAsync(params Expression>[] parameters) 75 | { 76 | return Tokens.AccessParameterReservedApiAsync(MethodType.Put, "media/{id}", "id", Utils.ExpressionToDictionary(parameters)); 77 | } 78 | 79 | /// 80 | public Task PutAsync(IDictionary parameters) 81 | { 82 | return Tokens.AccessParameterReservedApiAsync(MethodType.Put, "media/{id}", "id", parameters); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /TootNet/Rest/Mutes.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Mutes : ApiBase 13 | { 14 | internal Mutes(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// View muted accounts. 18 | /// Available parameters: 19 | /// - long max_id (optional) 20 | /// - long since_id (optional) 21 | /// - int limit (optional) 22 | /// 23 | /// The parameters. 24 | /// 25 | /// The task object representing the asynchronous operation. 26 | /// The Result property on the task object returns the list of account object. 27 | /// 28 | public Task> GetAsync(params Expression>[] parameters) 29 | { 30 | return Tokens.AccessApiAsync>(MethodType.Get, "mutes", Utils.ExpressionToDictionary(parameters)); 31 | } 32 | 33 | /// 34 | public Task> GetAsync(IDictionary parameters) 35 | { 36 | return Tokens.AccessApiAsync>(MethodType.Get, "mutes", parameters); 37 | } 38 | 39 | /// 40 | /// Mute account. 41 | /// Available parameters: 42 | /// - long id (required) 43 | /// - bool notifications (optional) 44 | /// - int duration (optional) 45 | /// 46 | /// The parameters. 47 | /// 48 | /// The task object representing the asynchronous operation. 49 | /// The Result property on the task object returns the relationship object. 50 | /// 51 | public Task MuteAsync(params Expression>[] parameters) 52 | { 53 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "accounts/{id}/mute", "id", Utils.ExpressionToDictionary(parameters)); 54 | } 55 | 56 | /// 57 | public Task MuteAsync(IDictionary parameters) 58 | { 59 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "accounts/{id}/mute", "id", parameters); 60 | } 61 | 62 | /// 63 | /// Unmute account. 64 | /// Available parameters: 65 | /// - long id (required) 66 | /// 67 | /// The parameters. 68 | /// 69 | /// The task object representing the asynchronous operation. 70 | /// The Result property on the task object returns the relationship object. 71 | /// 72 | public Task UnmuteAsync(params Expression>[] parameters) 73 | { 74 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "accounts/{id}/unmute", "id", Utils.ExpressionToDictionary(parameters)); 75 | } 76 | 77 | /// 78 | public Task UnmuteAsync(IDictionary parameters) 79 | { 80 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "accounts/{id}/unmute", "id", parameters); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /TootNet/Rest/OEmbed.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class OEmbed : ApiBase 13 | { 14 | internal OEmbed(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// Get OEmbed info as JSON. 18 | /// Available parameters: 19 | /// - string url (required) 20 | /// - int maxwidth (optional) 21 | /// - int maxheight (optional) 22 | /// 23 | /// The parameters. 24 | /// 25 | /// The task object representing the asynchronous operation. 26 | /// The Result property on the task object returns the oembed object. 27 | /// 28 | public Task GetAsync(params Expression>[] parameters) 29 | { 30 | return Tokens.AccessApiAsync(MethodType.Get, "/api/oembed", Utils.ExpressionToDictionary(parameters), useApiPath: false); 31 | } 32 | 33 | /// 34 | public Task GetAsync(IDictionary parameters) 35 | { 36 | return Tokens.AccessApiAsync(MethodType.Get, "/api/oembed", parameters, useApiPath: false); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /TootNet/Rest/Polls.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Polls : ApiBase 13 | { 14 | internal Polls(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// View a poll. 18 | /// Available parameters: 19 | /// - long id (required) 20 | /// 21 | /// The parameters. 22 | /// 23 | /// The task object representing the asynchronous operation. 24 | /// The Result property on the task object returns the poll object. 25 | /// 26 | public Task IdAsync(params Expression>[] parameters) 27 | { 28 | return Tokens.AccessParameterReservedApiAsync(MethodType.Get, "polls/{id}", "id", Utils.ExpressionToDictionary(parameters)); 29 | } 30 | 31 | /// 32 | public Task IdAsync(IDictionary parameters) 33 | { 34 | return Tokens.AccessParameterReservedApiAsync(MethodType.Get, "polls/{id}", "id", parameters); 35 | } 36 | 37 | /// 38 | /// Vote on a poll. 39 | /// Available parameters: 40 | /// - long id (required) 41 | /// - IEnumerable<int> choices (required) 42 | /// 43 | /// The parameters. 44 | /// 45 | /// The task object representing the asynchronous operation. 46 | /// The Result property on the task object returns the poll object. 47 | /// 48 | public Task VotesAsync(params Expression>[] parameters) 49 | { 50 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "polls/{id}/votes", "id", Utils.ExpressionToDictionary(parameters)); 51 | } 52 | 53 | /// 54 | public Task VotesAsync(IDictionary parameters) 55 | { 56 | return Tokens.AccessParameterReservedApiAsync(MethodType.Post, "polls/{id}/votes", "id", parameters); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /TootNet/Rest/Preferences.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Preferences : ApiBase 13 | { 14 | internal Preferences(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// View user preferences. 18 | /// Available parameters: 19 | /// - No parameters available in this method. 20 | /// 21 | /// The parameters. 22 | /// 23 | /// The task object representing the asynchronous operation. 24 | /// The Result property on the task object returns the dict string,object object. 25 | /// 26 | public Task> GetAsync(params Expression>[] parameters) 27 | { 28 | return Tokens.AccessApiAsync>(MethodType.Get, "preferences", Utils.ExpressionToDictionary(parameters)); 29 | } 30 | 31 | /// 32 | public Task> GetAsync(IDictionary parameters) 33 | { 34 | return Tokens.AccessApiAsync>(MethodType.Get, "preferences", parameters); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /TootNet/Rest/Profile.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Profile : ApiBase 13 | { 14 | internal Profile(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// Deletes the avatar associated with the user's profile. 18 | /// Available parameters: 19 | /// - No parameters available in this method. 20 | /// 21 | /// The parameters. 22 | /// 23 | /// The task object representing the asynchronous operation. 24 | /// The Result property on the task object returns the credentialaccount object. 25 | /// 26 | public Task DeleteAvatarAsync(params Expression>[] parameters) 27 | { 28 | return Tokens.AccessApiAsync(MethodType.Delete, "profile/avatar", Utils.ExpressionToDictionary(parameters)); 29 | } 30 | 31 | /// 32 | public Task DeleteAvatarAsync(IDictionary parameters) 33 | { 34 | return Tokens.AccessApiAsync(MethodType.Delete, "profile/avatar", parameters); 35 | } 36 | 37 | /// 38 | /// Deletes the header image associated with the user's profile. 39 | /// Available parameters: 40 | /// - No parameters available in this method. 41 | /// 42 | /// The parameters. 43 | /// 44 | /// The task object representing the asynchronous operation. 45 | /// The Result property on the task object returns the credentialaccount object. 46 | /// 47 | public Task DeleteHeaderAsync(params Expression>[] parameters) 48 | { 49 | return Tokens.AccessApiAsync(MethodType.Delete, "profile/header", Utils.ExpressionToDictionary(parameters)); 50 | } 51 | 52 | /// 53 | public Task DeleteHeaderAsync(IDictionary parameters) 54 | { 55 | return Tokens.AccessApiAsync(MethodType.Delete, "profile/header", parameters); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /TootNet/Rest/Reports.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Reports : ApiBase 13 | { 14 | internal Reports(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// File a report. 18 | /// Available parameters: 19 | /// - long account_id (required) 20 | /// - IEnumerable<long> status_ids (optional) 21 | /// - string comment (optional) 22 | /// - bool forward (optional) 23 | /// - string category (optional) 24 | /// - IEnumerable<int> rule_ids (optional) 25 | /// 26 | /// The parameters. 27 | /// 28 | /// The task object representing the asynchronous operation. 29 | /// The Result property on the task object returns the report object. 30 | /// 31 | public Task PostAsync(params Expression>[] parameters) 32 | { 33 | return Tokens.AccessApiAsync(MethodType.Post, "reports", Utils.ExpressionToDictionary(parameters)); 34 | } 35 | 36 | /// 37 | public Task PostAsync(IDictionary parameters) 38 | { 39 | return Tokens.AccessApiAsync(MethodType.Post, "reports", parameters); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /TootNet/Rest/Search.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Search : ApiBase 13 | { 14 | internal Search(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// Perform a search. 18 | /// Available parameters: 19 | /// - string q (required) 20 | /// - string type (allowed values of types: "accounts", "hashtags", "statuses") (optional) 21 | /// - bool resolve (optional) 22 | /// - bool following (optional) 23 | /// - long account_id (optional) 24 | /// - bool exclude_unreviewed (optional) 25 | /// - long max_id (optional) 26 | /// - long min_id (optional) 27 | /// - int limit (optional) 28 | /// - int offset (optional) 29 | /// 30 | /// The parameters. 31 | /// 32 | /// The task object representing the asynchronous operation. 33 | /// The Result property on the task object returns the search object. 34 | /// 35 | public Task GetAsync(params Expression>[] parameters) 36 | { 37 | return Tokens.AccessApiAsync(MethodType.Get, "search", Utils.ExpressionToDictionary(parameters), apiVersion: "v2"); 38 | } 39 | 40 | /// 41 | public Task GetAsync(IDictionary parameters) 42 | { 43 | return Tokens.AccessApiAsync(MethodType.Get, "search", parameters, apiVersion: "v2"); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /TootNet/Rest/Suggestions.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Suggestions : ApiBase 13 | { 14 | internal Suggestions(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// View follow suggestions. 18 | /// Available parameters: 19 | /// - int limit (optional) 20 | /// 21 | /// The parameters. 22 | /// 23 | /// The task object representing the asynchronous operation. 24 | /// The Result property on the task object returns the list of suggestion object. 25 | /// 26 | public Task> GetAsync(params Expression>[] parameters) 27 | { 28 | return Tokens.AccessApiAsync>(MethodType.Get, "suggestions", Utils.ExpressionToDictionary(parameters), apiVersion: "v2"); 29 | } 30 | 31 | /// 32 | public Task> GetAsync(IDictionary parameters) 33 | { 34 | return Tokens.AccessApiAsync>(MethodType.Get, "suggestions", parameters, apiVersion: "v2"); 35 | } 36 | 37 | /// 38 | /// Remove a suggestion. 39 | /// Available parameters: 40 | /// - long account_id (required) 41 | /// 42 | /// The parameters. 43 | /// 44 | /// The task object representing the asynchronous operation. 45 | /// The Result property on the task object returns the empty object. 46 | /// 47 | public Task DeleteAsync(params Expression>[] parameters) 48 | { 49 | return Tokens.AccessParameterReservedApiAsync(MethodType.Delete, "suggestions/{account_id}", "account_id", Utils.ExpressionToDictionary(parameters)); 50 | } 51 | 52 | /// 53 | public Task DeleteAsync(IDictionary parameters) 54 | { 55 | return Tokens.AccessParameterReservedApiAsync(MethodType.Delete, "suggestions/{account_id}", "account_id", parameters); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /TootNet/Rest/Trends.cs: -------------------------------------------------------------------------------- 1 | // Generated by TootNet.Generator. DO NOT EDIT! 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Threading.Tasks; 7 | using TootNet.Internal; 8 | using TootNet.Objects; 9 | 10 | namespace TootNet.Rest 11 | { 12 | public class Trends : ApiBase 13 | { 14 | internal Trends(Tokens e) : base(e) { } 15 | 16 | /// 17 | /// View trending tags. 18 | /// Available parameters: 19 | /// - int limit (optional) 20 | /// - int offset (optional) 21 | /// 22 | /// The parameters. 23 | /// 24 | /// The task object representing the asynchronous operation. 25 | /// The Result property on the task object returns the list of tag object. 26 | /// 27 | public Task> TagsAsync(params Expression>[] parameters) 28 | { 29 | return Tokens.AccessApiAsync>(MethodType.Get, "trends/tags", Utils.ExpressionToDictionary(parameters)); 30 | } 31 | 32 | /// 33 | public Task> TagsAsync(IDictionary parameters) 34 | { 35 | return Tokens.AccessApiAsync>(MethodType.Get, "trends/tags", parameters); 36 | } 37 | 38 | /// 39 | /// View trending statuses. 40 | /// Available parameters: 41 | /// - int limit (optional) 42 | /// - int offset (optional) 43 | /// 44 | /// The parameters. 45 | /// 46 | /// The task object representing the asynchronous operation. 47 | /// The Result property on the task object returns the list of status object. 48 | /// 49 | public Task> StatusesAsync(params Expression>[] parameters) 50 | { 51 | return Tokens.AccessApiAsync>(MethodType.Get, "trends/statuses", Utils.ExpressionToDictionary(parameters)); 52 | } 53 | 54 | /// 55 | public Task> StatusesAsync(IDictionary parameters) 56 | { 57 | return Tokens.AccessApiAsync>(MethodType.Get, "trends/statuses", parameters); 58 | } 59 | 60 | /// 61 | /// View trending links. 62 | /// Available parameters: 63 | /// - int limit (optional) 64 | /// - int offset (optional) 65 | /// 66 | /// The parameters. 67 | /// 68 | /// The task object representing the asynchronous operation. 69 | /// The Result property on the task object returns the list of trendslink object. 70 | /// 71 | public Task> LinksAsync(params Expression>[] parameters) 72 | { 73 | return Tokens.AccessApiAsync>(MethodType.Get, "trends/links", Utils.ExpressionToDictionary(parameters)); 74 | } 75 | 76 | /// 77 | public Task> LinksAsync(IDictionary parameters) 78 | { 79 | return Tokens.AccessApiAsync>(MethodType.Get, "trends/links", parameters); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /TootNet/Streaming/StreamingMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using TootNet.Objects; 3 | 4 | namespace TootNet.Streaming 5 | { 6 | public class StreamingMessage 7 | { 8 | public enum MessageType 9 | { 10 | Status = 0, 11 | StatusDelete = 1, 12 | Notification = 2, 13 | FiltersChanged = 3, 14 | Conversation = 4, 15 | Announcement = 5, 16 | AnnouncementReaction = 6, 17 | AnnouncementDelete = 7, 18 | StatusUpdate = 8, 19 | } 20 | 21 | public StreamingMessage(MessageType msgType) 22 | { 23 | Type = msgType; 24 | } 25 | 26 | public StreamingMessage(MessageType msgType, Status status) : this(msgType) 27 | { 28 | switch (msgType) 29 | { 30 | case MessageType.Status: 31 | Status = status; 32 | break; 33 | case MessageType.StatusUpdate: 34 | UpdatedStatus = status; 35 | break; 36 | default: 37 | throw new ArgumentException("Invalid message type received"); 38 | } 39 | } 40 | 41 | public StreamingMessage(MessageType msgType, Notification notification) : this(msgType) 42 | { 43 | if (msgType != MessageType.Notification) 44 | throw new ArgumentException("Invalid message type received"); 45 | 46 | Notification = notification; 47 | } 48 | 49 | public StreamingMessage(MessageType msgType, Conversation conversation) : this(msgType) 50 | { 51 | if (msgType != MessageType.Conversation) 52 | throw new ArgumentException("Invalid message type received"); 53 | 54 | Conversation = conversation; 55 | } 56 | 57 | public StreamingMessage(MessageType msgType, Announcement announcement) : this(msgType) 58 | { 59 | if (msgType != MessageType.Announcement) 60 | throw new ArgumentException("Invalid message type received"); 61 | 62 | Announcement = announcement; 63 | } 64 | 65 | public StreamingMessage(MessageType msgType, Reaction announcementReaction) : this(msgType) 66 | { 67 | if (msgType != MessageType.AnnouncementReaction) 68 | throw new ArgumentException("Invalid message type received"); 69 | 70 | AnnouncementReaction = announcementReaction; 71 | } 72 | 73 | public StreamingMessage(MessageType msgType, long id) : this(msgType) 74 | { 75 | switch (msgType) 76 | { 77 | case MessageType.StatusDelete: 78 | DeletedStatusId = id; 79 | break; 80 | case MessageType.AnnouncementDelete: 81 | DeletedAnnouncementId = id; 82 | break; 83 | default: 84 | throw new ArgumentException("Invalid message type received"); 85 | } 86 | } 87 | 88 | public MessageType Type { get; set; } 89 | 90 | public Status Status { get; set; } 91 | public Status UpdatedStatus { get; set; } 92 | public long? DeletedStatusId { get; set; } 93 | public Notification Notification { get; set; } 94 | public Conversation Conversation { get; set; } 95 | public Announcement Announcement { get; set; } 96 | public Reaction AnnouncementReaction { get; set; } 97 | public long? DeletedAnnouncementId { get; set; } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /TootNet/Streaming/StreamingType.cs: -------------------------------------------------------------------------------- 1 | namespace TootNet.Streaming 2 | { 3 | public enum StreamingType 4 | { 5 | User = 0, 6 | UserNotification = 1, 7 | Public = 2, 8 | PublicLocal = 3, 9 | PublicRemote = 4, 10 | Hashtag = 5, 11 | HashtagLocal = 6, 12 | List = 7, 13 | Direct = 8 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /TootNet/TootNet.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | TootNet is Mastodon library for .NET Standard. 6 | See also: https://github.com/cucmberium/TootNet 7 | 8 | This software is licensed under the MIT License. 9 | This library uses part of the codes of the following libraries. 10 | - Mastonet 11 | - CoreTweet 12 | 13 | cucmberium 14 | https://github.com/cucmberium/TootNet 15 | https://github.com/cucmberium/TootNet/blob/master/LICENSE 16 | true 17 | (c) 2017-2024 cucmberium 18 | https://github.com/cucmberium/TootNet 19 | Mastodon 20 | 4.3.0 21 | false 22 | README.md 23 | 24 | 25 | 26 | bin\Release\netstandard1.4\TootNet.xml 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | True 36 | \ 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | --------------------------------------------------------------------------------