Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LinkAce.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CI Workflows", "CI Workflow
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinkAce.NET", "src\LinkAce.NET\LinkAce.NET.csproj", "{6C83B6FB-E141-46BA-A446-8346BB11A7E3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "src\TestApp\TestApp.csproj", "{97052387-BAA1-40E8-A861-C412B373FBDC}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClient", "src\TestClient\TestClient.csproj", "{97052387-BAA1-40E8-A861-C412B373FBDC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
22 changes: 0 additions & 22 deletions src/TestApp/Program.cs

This file was deleted.

46 changes: 46 additions & 0 deletions src/TestClient/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System.Net;
using System.Text;
using LinkAce.NET;
using LinkAce.NET.Entites;
using LinkAce.NET.Extensions;
using Microsoft.Extensions.Configuration;
Console.WriteLine("Hello, World!");

var configuration = new ConfigurationBuilder()
.AddYamlFile("settings.yml", false, true)
.Build();

var handler = new HttpClientHandler()
{
Proxy = new WebProxy("localhost:8080", false)
};
var httpClient = new HttpClient(handler);

var linkAceConfig = configuration.GetSection("LinkAce");
var linkAceClient = new LinkAceClient(linkAceConfig["Url"] ?? throw new InvalidOperationException(),
linkAceConfig["ApiToken"] ?? throw new InvalidOperationException(),
httpClient);
var results = linkAceClient.SearchLinksByUrl("jrgnsn.net").GetAwaiter().GetResult();
var createResult = linkAceClient.CreateLink(
new Link()
{
Title = "Test Link",
Url = "https://jrgnsn.net",
Description = "A test link",
Tags = new[]{ "test" }.ToTagArray()
}).GetAwaiter().GetResult();

var _ = () => { };

string RandomString(int size)
{
Random random = new((int)DateTime.Now.Ticks);
StringBuilder builder = new();
char ch;
for (int i = 0; i < size; i++)
{
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26*random.NextDouble() + 65)));
builder.Append(ch);
}
return builder.ToString();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>False</IsPackable>
Expand Down