Skip to content

Commit

Permalink
Merge pull request #28 from Amino-NET-Group/dev
Browse files Browse the repository at this point in the history
Merge Amino.NET 1.5.2
  • Loading branch information
FabioGaming authored May 6, 2024
2 parents 4d4d5ed + be91f42 commit 6599f01
Show file tree
Hide file tree
Showing 8 changed files with 1,971 additions and 2,313 deletions.
6 changes: 3 additions & 3 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: fabiogaming
patreon: #
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
ko_fi: fabiothefox
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: ["https://www.paypal.me/FabioTheFox", ]
custom: []
41 changes: 41 additions & 0 deletions .github/workflows/dev-autopublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish NuGet Package

on:
push:
branches:
- dev

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.x'

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release

- name: Determine version
id: version
run: echo "::set-output name=version::0.$((${GITHUB_RUN_NUMBER} / 10)).$((${GITHUB_RUN_NUMBER} % 10))"

- name: Get Project Version
id: base_version
run: |
version=$(grep '<Version>' < Amino.NET/Amino.NET.csproj | sed 's/.*<Version>\(.*\)<\/Version>/\1/')
echo "::set-output name=version::$version"
- name: Pack
run: dotnet pack --configuration Release /p:Version="${{ steps.base_version.outputs.version }}-dev${{ steps.version.outputs.version }}" --output nupkgs

- name: Publish to NuGet
run: dotnet nuget push nupkgs/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
25 changes: 25 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Dev Test

on:
pull_request:
branches:
- dev

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.x'

- name: Restore dependencies
run: dotnet restore

- name: Build and test
run: dotnet build --configuration Release && dotnet test --no-build --verbosity normal
2 changes: 1 addition & 1 deletion Amino.NET/Amino.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Version>1.5.1</Version>
<Version>1.5.2</Version>
<Authors>FabioTheFox</Authors>
<Company>FabiDev</Company>
<Description>An unofficial C# wrapper for Aminos REST API for making amino bots and tools</Description>
Expand Down
64 changes: 64 additions & 0 deletions Amino.NET/Builders/PostBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Reflection.Metadata.Ecma335;

namespace Amino.NET.Builders
{
public class PostBuilder
{
public byte[] CoverImage { get; private set; }
public byte[] BackgroundImage { get; private set; }
public string BackgroundColor { get; private set; } = "#ffffff";
public string Content { get; set; }
public string Title { get; set; }
public List<(byte[], string?, string?)> MediaList { get; } = new List<(byte[], string?, string?)>();
public PostTypes PostType { get; set; } = PostTypes.Blog;
public BackgroundTypes BackgroundType { get; set; } = BackgroundTypes.Color;
public bool FansOnly { get; set; }


public void WithCover(byte[] cover)
{
CoverImage = cover;
}
public void WithCover(string coverPath)
{
WithCover(File.ReadAllBytes(coverPath));
}

public void WithBackgroundImage(byte[] media)
{
BackgroundImage = media;
}

public void WithBackgroundImage(string mediaPath)
{
WithBackgroundImage(File.ReadAllBytes(mediaPath));
}

public void AddMedia(byte[] media, string mediaKey = null, string caption = null)
{
MediaList.Add((media, mediaKey, caption));
}

public void AddMedia(string mediaPath, string mediaKey = null, string caption = null)
{
AddMedia(File.ReadAllBytes(mediaPath), mediaKey, caption);
}

public string EmbedImage(string mediaKey) => $"[IMG={mediaKey}]";

public enum PostTypes
{
Blog,
Wiki
}
public enum BackgroundTypes
{
Color,
Image
}

}
}
Loading

0 comments on commit 6599f01

Please sign in to comment.