Skip to content

Commit 53e1b4f

Browse files
committed
started builder class
[ # ] Fixed Client.register() throwing invalid request due to newtonsoft JSON [ # ] Fixed typo in Types class [ + ] Added start of builder class
1 parent bb41fc2 commit 53e1b4f

3 files changed

Lines changed: 41 additions & 2 deletions

File tree

Amino.NET/Builders/PostBuilder.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Collections.Generic;
2+
using System.IO;
3+
4+
namespace Amino.NET.Builders
5+
{
6+
public class PostBuilder
7+
{
8+
public byte[] CoverImage { get; private set; }
9+
public string Content { get; set; }
10+
public string Title { get; set; }
11+
public Dictionary<byte[], string> MediaList { get; } = new Dictionary<byte[], string>();
12+
public PostTypes PostType { get; set; } = PostTypes.Blog;
13+
14+
public void WithCover(byte[] cover)
15+
{
16+
CoverImage = cover;
17+
}
18+
public void WithCover(string coverPath)
19+
{
20+
WithCover(File.ReadAllBytes(coverPath));
21+
}
22+
public void AddMedia(byte[] media, string mediaKey)
23+
{
24+
MediaList.Add(media, mediaKey);
25+
}
26+
27+
public void AddMedia(string mediaPath, string mediaKey)
28+
{
29+
AddMedia(File.ReadAllBytes(mediaPath), mediaKey);
30+
}
31+
32+
public enum PostTypes
33+
{
34+
Blog,
35+
Wiki
36+
}
37+
38+
}
39+
}

Amino.NET/Client.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ public Task register(string _name, string _email, string _password, string _veri
456456
{ "clientCallbackURL", "narviiapp://relogin" },
457457
{ "validationContext", new JObject()
458458
{
459-
{ "data", new JObject() { "code", _verificationCode } },
459+
{ "data", new JObject() { {"code", _verificationCode } } },
460460
{ "type", 1 },
461461
{ "identity", _email }
462462
}

Amino.NET/Types.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public enum User_Types
127127
}
128128
public enum Featured_Types
129129
{
130-
Unfreature,
130+
Unfeature,
131131
User,
132132
Blog,
133133
Wiki,

0 commit comments

Comments
 (0)