Skip to content

Commit 6599f01

Browse files
authored
Merge pull request #28 from Amino-NET-Group/dev
Merge Amino.NET 1.5.2
2 parents 4d4d5ed + be91f42 commit 6599f01

File tree

8 files changed

+1971
-2313
lines changed

8 files changed

+1971
-2313
lines changed

.github/FUNDING.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# These are supported funding model platforms
22

33
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4-
patreon: fabiogaming
4+
patreon: #
55
open_collective: # Replace with a single Open Collective username
6-
ko_fi: # Replace with a single Ko-fi username
6+
ko_fi: fabiothefox
77
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
88
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
99
liberapay: # Replace with a single Liberapay username
1010
issuehunt: # Replace with a single IssueHunt username
1111
otechie: # Replace with a single Otechie username
1212
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13-
custom: ["https://www.paypal.me/FabioTheFox", ]
13+
custom: []
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish NuGet Package
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: '7.x'
20+
21+
- name: Restore dependencies
22+
run: dotnet restore
23+
24+
- name: Build
25+
run: dotnet build --configuration Release
26+
27+
- name: Determine version
28+
id: version
29+
run: echo "::set-output name=version::0.$((${GITHUB_RUN_NUMBER} / 10)).$((${GITHUB_RUN_NUMBER} % 10))"
30+
31+
- name: Get Project Version
32+
id: base_version
33+
run: |
34+
version=$(grep '<Version>' < Amino.NET/Amino.NET.csproj | sed 's/.*<Version>\(.*\)<\/Version>/\1/')
35+
echo "::set-output name=version::$version"
36+
37+
- name: Pack
38+
run: dotnet pack --configuration Release /p:Version="${{ steps.base_version.outputs.version }}-dev${{ steps.version.outputs.version }}" --output nupkgs
39+
40+
- name: Publish to NuGet
41+
run: dotnet nuget push nupkgs/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

.github/workflows/tests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Dev Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- dev
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: '7.x'
20+
21+
- name: Restore dependencies
22+
run: dotnet restore
23+
24+
- name: Build and test
25+
run: dotnet build --configuration Release && dotnet test --no-build --verbosity normal

Amino.NET/Amino.NET.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net7.0</TargetFramework>
5-
<Version>1.5.1</Version>
5+
<Version>1.5.2</Version>
66
<Authors>FabioTheFox</Authors>
77
<Company>FabiDev</Company>
88
<Description>An unofficial C# wrapper for Aminos REST API for making amino bots and tools</Description>

Amino.NET/Builders/PostBuilder.cs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
using System.Collections.Generic;
2+
using System.ComponentModel;
3+
using System.IO;
4+
using System.Reflection.Metadata.Ecma335;
5+
6+
namespace Amino.NET.Builders
7+
{
8+
public class PostBuilder
9+
{
10+
public byte[] CoverImage { get; private set; }
11+
public byte[] BackgroundImage { get; private set; }
12+
public string BackgroundColor { get; private set; } = "#ffffff";
13+
public string Content { get; set; }
14+
public string Title { get; set; }
15+
public List<(byte[], string?, string?)> MediaList { get; } = new List<(byte[], string?, string?)>();
16+
public PostTypes PostType { get; set; } = PostTypes.Blog;
17+
public BackgroundTypes BackgroundType { get; set; } = BackgroundTypes.Color;
18+
public bool FansOnly { get; set; }
19+
20+
21+
public void WithCover(byte[] cover)
22+
{
23+
CoverImage = cover;
24+
}
25+
public void WithCover(string coverPath)
26+
{
27+
WithCover(File.ReadAllBytes(coverPath));
28+
}
29+
30+
public void WithBackgroundImage(byte[] media)
31+
{
32+
BackgroundImage = media;
33+
}
34+
35+
public void WithBackgroundImage(string mediaPath)
36+
{
37+
WithBackgroundImage(File.ReadAllBytes(mediaPath));
38+
}
39+
40+
public void AddMedia(byte[] media, string mediaKey = null, string caption = null)
41+
{
42+
MediaList.Add((media, mediaKey, caption));
43+
}
44+
45+
public void AddMedia(string mediaPath, string mediaKey = null, string caption = null)
46+
{
47+
AddMedia(File.ReadAllBytes(mediaPath), mediaKey, caption);
48+
}
49+
50+
public string EmbedImage(string mediaKey) => $"[IMG={mediaKey}]";
51+
52+
public enum PostTypes
53+
{
54+
Blog,
55+
Wiki
56+
}
57+
public enum BackgroundTypes
58+
{
59+
Color,
60+
Image
61+
}
62+
63+
}
64+
}

0 commit comments

Comments
 (0)