Initial commit

This commit is contained in:
2025-11-15 20:06:01 -05:00
commit 6d50386eba
24 changed files with 1192 additions and 0 deletions

484
.gitignore vendored Normal file
View File

@@ -0,0 +1,484 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from `dotnet new gitignore`
# dotenv files
.env
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET
project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
.idea/
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/main/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/main/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# Vim temporary swap files
*.swp

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Chris Kaczor
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

27
Library/EnumExtensions.cs Normal file
View File

@@ -0,0 +1,27 @@
using System.Reflection;
namespace ChrisKaczor.MinifluxClient;
internal static class EnumExtensions
{
internal static TAttribute? GetAttribute<TAttribute>(this Enum enumValue) where TAttribute : Attribute
{
var type = enumValue.GetType();
var name = Enum.GetName(type, enumValue);
if (name == null)
return null;
var field = type.GetField(name);
var attribute = field?.GetCustomAttribute<TAttribute>();
return attribute;
}
extension<T>(T value) where T : Enum
{
internal string QueryPropertyName => value.GetAttribute<QueryParameterNameAttribute>()?.Name ?? string.Empty;
}
}

View File

@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
namespace ChrisKaczor.MinifluxClient;
public enum FeedEntryStatus
{
[JsonStringEnumMemberName("read")]
Read,
[JsonStringEnumMemberName("unread")]
Unread
}

101
Library/MinifluxClient.cs Normal file
View File

@@ -0,0 +1,101 @@
using ChrisKaczor.MinifluxClient.Models;
using RestSharp;
using System.Text.Json;
namespace ChrisKaczor.MinifluxClient;
public class MinifluxClient
{
private readonly JsonSerializerOptions _jsonSerializerOptions;
private readonly RestClient _restClient;
public MinifluxClient(string url, string apiKey)
{
_jsonSerializerOptions = new JsonSerializerOptions();
_restClient = new RestClient(url);
_restClient.AddDefaultHeader("X-Auth-Token", apiKey);
}
private async Task<T?> ExecuteRestRequest<T>(string api, Method method, IEnumerable<Parameter>? parameters, object? body)
{
var request = new RestRequest($"/v1/{api}", method);
if (parameters != null)
{
foreach (var parameter in parameters)
{
request.AddParameter(parameter);
}
}
if (body != null)
{
var bodyJson = JsonSerializer.Serialize(body, _jsonSerializerOptions);
request.AddStringBody(bodyJson, DataFormat.Json);
}
var response = await _restClient.ExecuteAsync(request);
if (response == null)
throw new Exception("Failed to get response from API");
if (!response.IsSuccessStatusCode)
throw new Exception($"Error: {response.StatusCode} - {response.Content}");
if (response.Content == null)
throw new Exception("Response content is null");
if (string.IsNullOrWhiteSpace(response.Content))
return default;
try
{
var responseObject = JsonSerializer.Deserialize<T>(response.Content, _jsonSerializerOptions);
return responseObject ?? throw new Exception($"Failed to deserialize response content - {response.Content}");
}
catch (Exception e)
{
throw new Exception($"Failed to deserialize response content - {response.Content}", e);
}
}
public async Task<IEnumerable<Category>> GetCategories()
{
var response = await ExecuteRestRequest<IEnumerable<Category>>("categories", Method.Get, null, null);
return response ?? [];
}
public async Task<IEnumerable<Feed>> GetFeeds()
{
var response = await ExecuteRestRequest<IEnumerable<Feed>>("feeds", Method.Get, null, null);
return response ?? [];
}
public async Task<IEnumerable<Entry>> GetFeedEntries(long feedId, SortField sortField, SortDirection sortDirection)
{
var parameters = new List<Parameter>
{
new QueryParameter(SortField.QueryParameterName, sortField.QueryPropertyName),
new QueryParameter(SortDirection.QueryParameterName, sortDirection.QueryPropertyName)
};
var response = await ExecuteRestRequest<EntriesResponse>($"feeds/{feedId}/entries", Method.Get, parameters, null);
return response?.Entries ?? [];
}
public async Task MarkFeedEntries(IEnumerable<long> entryIds, FeedEntryStatus status)
{
var updateEntryRequest = new Requests.UpdateEntryRequest
{
EntryIds = entryIds,
Status = status
};
await ExecuteRestRequest<object>("entries", Method.Put, null, updateEntryRequest);
}
}

View File

@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>ChrisKaczor.MinifluxClient</RootNamespace>
<Title>ChrisKaczor.MinifluxClient</Title>
<Authors>Chris Kaczor</Authors>
<Product>ChrisKaczor.MinifluxClient</Product>
<RepositoryUrl>https://github.com/ckaczor/ChrisKaczor.MinifluxClient</RepositoryUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Description>This library can be used to read RSS feeds via the Miniflux API.</Description>
<PackageId>ChrisKaczor.MinifluxClient</PackageId>
<AssemblyName>ChrisKaczor.MinifluxClient</AssemblyName>
</PropertyGroup>
<ItemGroup>
<None Remove="MinifluxClient.sln.DotSettings" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageReference Include="RestSharp" Version="112.1.0" />
</ItemGroup>
<ItemGroup>
<None Update="README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Kaczor/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Miniflux/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -0,0 +1,20 @@
using JetBrains.Annotations;
using System.Text.Json.Serialization;
namespace ChrisKaczor.MinifluxClient.Models;
[PublicAPI]
public class Category
{
[JsonPropertyName("id")]
public required long Id { get; set; }
[JsonPropertyName("title")]
public required string Title { get; set; }
[JsonPropertyName("user_id")]
public required long UserId { get; set; }
[JsonPropertyName("hide_globally")]
public required bool HideGlobally { get; set; }
}

View File

@@ -0,0 +1,26 @@
using JetBrains.Annotations;
using System.Text.Json.Serialization;
namespace ChrisKaczor.MinifluxClient.Models;
[PublicAPI]
public class Enclosure
{
[JsonPropertyName("id")]
public required long Id { get; set; }
[JsonPropertyName("user_id")]
public required long UserId { get; set; }
[JsonPropertyName("entry_id")]
public required long EntryId { get; set; }
[JsonPropertyName("url")]
public required string Url { get; set; }
[JsonPropertyName("mime_type")]
public required string MimeType { get; set; }
[JsonPropertyName("size")]
public required long Size { get; set; }
}

View File

@@ -0,0 +1,14 @@
using JetBrains.Annotations;
using System.Text.Json.Serialization;
namespace ChrisKaczor.MinifluxClient.Models;
[PublicAPI]
public class EntriesResponse
{
[JsonPropertyName("total")]
public required int Total { get; set; }
[JsonPropertyName("entries")]
public required List<Entry> Entries { get; set; }
}

65
Library/Models/Entry.cs Normal file
View File

@@ -0,0 +1,65 @@
using JetBrains.Annotations;
using System.Text.Json.Serialization;
namespace ChrisKaczor.MinifluxClient.Models;
[PublicAPI]
public class Entry
{
[JsonPropertyName("id")]
public required long Id { get; set; }
[JsonPropertyName("user_id")]
public required long UserId { get; set; }
[JsonPropertyName("feed_id")]
public required long FeedId { get; set; }
[JsonPropertyName("status")]
public required string Status { get; set; }
[JsonPropertyName("hash")]
public required string Hash { get; set; }
[JsonPropertyName("title")]
public required string Title { get; set; }
[JsonPropertyName("url")]
public required string Url { get; set; }
[JsonPropertyName("comments_url")]
public required string CommentsUrl { get; set; }
[JsonPropertyName("published_at")]
public required DateTimeOffset PublishedAt { get; set; }
[JsonPropertyName("created_at")]
public required DateTimeOffset CreatedAt { get; set; }
[JsonPropertyName("changed_at")]
public required DateTimeOffset ChangedAt { get; set; }
[JsonPropertyName("content")]
public required string Content { get; set; }
[JsonPropertyName("author")]
public required string Author { get; set; }
[JsonPropertyName("share_code")]
public required string ShareCode { get; set; }
[JsonPropertyName("starred")]
public required bool Starred { get; set; }
[JsonPropertyName("reading_time")]
public required int ReadingTime { get; set; }
[JsonPropertyName("enclosures")]
public required List<Enclosure> Enclosures { get; set; }
[JsonPropertyName("feed")]
public required Feed Feed { get; set; }
[JsonPropertyName("tags")]
public required List<string> Tags { get; set; }
}

131
Library/Models/Feed.cs Normal file
View File

@@ -0,0 +1,131 @@
using JetBrains.Annotations;
using System.Text.Json.Serialization;
namespace ChrisKaczor.MinifluxClient.Models;
[PublicAPI]
public class Feed
{
[JsonPropertyName("id")]
public required long Id { get; set; }
[JsonPropertyName("user_id")]
public required long UserId { get; set; }
[JsonPropertyName("feed_url")]
public required string FeedUrl { get; set; }
[JsonPropertyName("site_url")]
public required string SiteUrl { get; set; }
[JsonPropertyName("title")]
public required string Title { get; set; }
[JsonPropertyName("description")]
public required string Description { get; set; }
[JsonPropertyName("checked_at")]
public required DateTimeOffset CheckedAt { get; set; }
[JsonPropertyName("next_check_at")]
public required DateTimeOffset NextCheckAt { get; set; }
[JsonPropertyName("etag_header")]
public required string EtagHeader { get; set; }
[JsonPropertyName("last_modified_header")]
public required string LastModifiedHeader { get; set; }
[JsonPropertyName("parsing_error_message")]
public required string ParsingErrorMessage { get; set; }
[JsonPropertyName("parsing_error_count")]
public required int ParsingErrorCount { get; set; }
[JsonPropertyName("scraper_rules")]
public required string ScraperRules { get; set; }
[JsonPropertyName("rewrite_rules")]
public required string RewriteRules { get; set; }
[JsonPropertyName("blocklist_rules")]
public required string BlocklistRules { get; set; }
[JsonPropertyName("keeplist_rules")]
public required string KeeplistRules { get; set; }
[JsonPropertyName("block_filter_entry_rules")]
public required string BlockFilterEntryRules { get; set; }
[JsonPropertyName("keep_filter_entry_rules")]
public required string KeepFilterEntryRules { get; set; }
[JsonPropertyName("urlrewrite_rules")]
public required string UrlrewriteRules { get; set; }
[JsonPropertyName("user_agent")]
public required string UserAgent { get; set; }
[JsonPropertyName("cookie")]
public required string Cookie { get; set; }
[JsonPropertyName("username")]
public required string Username { get; set; }
[JsonPropertyName("password")]
public required string Password { get; set; }
[JsonPropertyName("disabled")]
public required bool Disabled { get; set; }
[JsonPropertyName("no_media_player")]
public required bool NoMediaPlayer { get; set; }
[JsonPropertyName("ignore_http_cache")]
public required bool IgnoreHttpCache { get; set; }
[JsonPropertyName("allow_self_signed_certificates")]
public required bool AllowSelfSignedCertificates { get; set; }
[JsonPropertyName("fetch_via_proxy")]
public required bool FetchViaProxy { get; set; }
[JsonPropertyName("hide_globally")]
public required bool HideGlobally { get; set; }
[JsonPropertyName("disable_http2")]
public required bool DisableHttp2 { get; set; }
[JsonPropertyName("pushover_enabled")]
public required bool PushoverEnabled { get; set; }
[JsonPropertyName("ntfy_enabled")]
public required bool NtfyEnabled { get; set; }
[JsonPropertyName("crawler")]
public required bool Crawler { get; set; }
[JsonPropertyName("apprise_service_urls")]
public required string AppriseServiceUrls { get; set; }
[JsonPropertyName("webhook_url")]
public required string WebhookUrl { get; set; }
[JsonPropertyName("ntfy_priority")]
public required int NtfyPriority { get; set; }
[JsonPropertyName("ntfy_topic")]
public required string NtfyTopic { get; set; }
[JsonPropertyName("pushover_priority")]
public required int PushoverPriority { get; set; }
[JsonPropertyName("proxy_url")]
public required string ProxyUrl { get; set; }
[JsonPropertyName("category")]
public required Category Category { get; set; }
[JsonPropertyName("icon")]
public required Icon Icon { get; set; }
}

17
Library/Models/Icon.cs Normal file
View File

@@ -0,0 +1,17 @@
using JetBrains.Annotations;
using System.Text.Json.Serialization;
namespace ChrisKaczor.MinifluxClient.Models;
[PublicAPI]
public class Icon
{
[JsonPropertyName("feed_id")]
public required long FeedId { get; set; }
[JsonPropertyName("icon_id")]
public required long IconId { get; set; }
[JsonPropertyName("external_icon_id")]
public required string ExternalIconId { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace ChrisKaczor.MinifluxClient;
[AttributeUsage(AttributeTargets.Enum | AttributeTargets.Field)]
internal class QueryParameterNameAttribute(string name) : Attribute
{
public string Name { get; } = name;
}

View File

@@ -0,0 +1,13 @@
using System.Text.Json.Serialization;
namespace ChrisKaczor.MinifluxClient.Requests;
public class UpdateEntryRequest
{
[JsonPropertyName("entry_ids")]
public required IEnumerable<long> EntryIds { get; set; }
[JsonPropertyName("status")]
[JsonConverter(typeof(JsonStringEnumConverter))]
public required FeedEntryStatus Status { get; set; }
}

21
Library/SortDirection.cs Normal file
View File

@@ -0,0 +1,21 @@
using System.Reflection;
namespace ChrisKaczor.MinifluxClient;
[QueryParameterName("direction")]
public enum SortDirection
{
[QueryParameterName("asc")]
Ascending,
[QueryParameterName("desc")]
Descending
}
internal static class SortDirectionExtensions
{
extension(SortDirection)
{
internal static string QueryParameterName => typeof(SortDirection).GetCustomAttribute<QueryParameterNameAttribute>()?.Name ?? throw new InvalidOperationException();
}
}

30
Library/SortField.cs Normal file
View File

@@ -0,0 +1,30 @@
using System.Reflection;
namespace ChrisKaczor.MinifluxClient;
[QueryParameterName("order")]
public enum SortField
{
[QueryParameterName("id")]
Id,
[QueryParameterName("status")]
Status,
[QueryParameterName("published_at")]
PublishedAt,
[QueryParameterName("category_title")]
CategoryTitle,
[QueryParameterName("category_id")]
CategoryId
}
internal static class SortFieldExtensions
{
extension(SortField)
{
internal static string QueryParameterName => typeof(SortField).GetCustomAttribute<QueryParameterNameAttribute>()?.Name ?? throw new InvalidOperationException();
}
}

38
MinifluxClient.sln Normal file
View File

@@ -0,0 +1,38 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.0.11018.127
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MinifluxClient", "Library\MinifluxClient.csproj", "{85FE0D62-97D7-43DD-AC1B-F596762D0E33}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{206AEC91-0AFD-4E4B-AB88-853599C08D86}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{19E773CA-D190-46D9-8B87-05DB359562FC}"
ProjectSection(SolutionItems) = preProject
azure-pipelines.yml = azure-pipelines.yml
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{85FE0D62-97D7-43DD-AC1B-F596762D0E33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85FE0D62-97D7-43DD-AC1B-F596762D0E33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85FE0D62-97D7-43DD-AC1B-F596762D0E33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85FE0D62-97D7-43DD-AC1B-F596762D0E33}.Release|Any CPU.Build.0 = Release|Any CPU
{206AEC91-0AFD-4E4B-AB88-853599C08D86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{206AEC91-0AFD-4E4B-AB88-853599C08D86}.Debug|Any CPU.Build.0 = Debug|Any CPU
{206AEC91-0AFD-4E4B-AB88-853599C08D86}.Release|Any CPU.ActiveCfg = Release|Any CPU
{206AEC91-0AFD-4E4B-AB88-853599C08D86}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F01F2A17-ECF5-4F99-A61E-633332945FB2}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Kaczor/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Miniflux/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

17
README.md Normal file
View File

@@ -0,0 +1,17 @@
# ChrisKaczor.MinifluxClient
This library can be used to read RSS feeds via the Miniflux API in [Miniflux](https://miniflux.app/index.html) or other similar feed readers/servers.
Not fully implemented (at least so far) and only tested with [Miniflux](https://miniflux.app/index.html) but works for my needs in [Feed Center](http://github.com/ckaczor/FeedCenter).
## Authors
* **Chris Kaczor** - *Initial work* - https://github.com/ckaczor - https://chriskaczor.com
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
## Disclaimer
This code is used by my various personal projects and may not be useful or work in all use cases.

1
Test/MSTestSettings.cs Normal file
View File

@@ -0,0 +1 @@
[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)]

22
Test/Test.csproj Normal file
View File

@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MSTest" Version="4.0.0-preview.25465.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Library\MinifluxClient.csproj" />
</ItemGroup>
<ItemGroup>
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
</ItemGroup>
</Project>

22
Test/Test1.cs Normal file
View File

@@ -0,0 +1,22 @@
using ChrisKaczor.MinifluxClient;
namespace Test;
[TestClass]
public sealed class Test
{
[TestMethod]
public async Task TestMethod1()
{
var client = new MinifluxClient("", "");
var categories = await client.GetCategories();
var feeds = await client.GetFeeds();
foreach (var feed in feeds)
{
var feedEntries = await client.GetFeedEntries(feed.Id, SortField.PublishedAt, SortDirection.Descending);
}
}
}

63
azure-pipelines.yml Normal file
View File

@@ -0,0 +1,63 @@
name: 1.0.$(Rev:r)
pr: none
trigger:
batch: 'true'
branches:
include:
- main
pool:
vmImage: 'windows-latest'
variables:
buildConfiguration: 'Release'
steps:
- task: GetRevision@1
displayName: 'Get Revision'
inputs:
VariableName: Revision
- task: Assembly-Info-NetCore@3
displayName: 'Set Assembly Info'
inputs:
Path: '$(Build.SourcesDirectory)'
FileNames: 'Library\*.csproj'
InsertAttributes: true
FileEncoding: 'utf-8'
WriteBOM: true
FailOnWarning: true
Authors: 'Chris Kaczor'
Copyright: 'Copyright $(date:YYYY) Chris Kaczor'
FileVersion: '1.0.$(Revision)'
PackageVersion: '1.0.$(Revision)'
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: 'build'
arguments: '--configuration $(buildConfiguration)'
projects: 'Library\MinifluxClient.csproj'
- task: DotNetCoreCLI@2
displayName: "dotnet pack"
inputs:
command: 'pack'
arguments: '--configuration $(buildConfiguration)'
packagesToPack: 'Library\MinifluxClient.csproj'
nobuild: true
versioningScheme: 'byBuildNumber'
- task: NuGetCommand@2
displayName: 'nuget push'
inputs:
command: 'push'
feedsToUse: 'select'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: external
publishFeedCredentials: 'NuGet'
publishVstsFeed: 'Packages'
versioningScheme: 'byBuildNumber'
allowPackageConflicts: true