-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiceBear.cs
215 lines (177 loc) · 7.27 KB
/
DiceBear.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
using System;
namespace Bogus
{
public class DiceBear : DataSet
{
private Random _randomShared = new Random();
private string _diceBearBaseURL = "https://api.dicebear.com/9.x/";
private string[] _collections = new string[]
{
"adventurer-neutral",
"adventurer",
"avataaars-neutral",
"avataaars",
"big-ears-neutral",
"big-ears",
"big-smile",
"bottts-neutral",
"bottts",
"croodles-neutral",
"croodles",
"dylan",
"fun-emoji",
"glass",
"icons",
"identicon",
"initials",
"lorelei-neutral",
"lorelei",
"micah",
"miniavs",
"notionists-neutral",
"notionists",
"open-peeps",
"personas",
"pixel-art-neutral",
"pixel-art",
"rings",
"shapes",
"thumbs",
};
public string[] Collections => _collections;
public string RandomAvatar(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
int position = _randomShared.Next(_collections.Length);
return Avatar(_collections[position], format, seed, size);
}
public string Avatar(string collection = "open-peeps", string format = "svg", string seed = null, int size = 64, int scale = 100)
{
if (seed == null)
{
seed = Guid.NewGuid().ToString();
}
return $"{_diceBearBaseURL}{collection}/{format}?seed={seed}&size={size}&scale={scale}";
}
public string Adventurer(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("adventurer", format, seed, size);
}
public string AdventurerNeutral(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("adventurer-neutral", format, seed, size);
}
public string Avataaars(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("avataaars", format, seed, size);
}
public string AvataaarsNeutral(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("avataaars-neutral", format, seed, size);
}
public string BigEars(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("big-ears", format, seed, size);
}
public string BigEarsNeutral(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("big-ears-neutral", format, seed, size);
}
public string BigSmile(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("big-smile", format, seed, size);
}
public string Bottts(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("bottts", format, seed, size);
}
public string BotttsNeutral(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("bottts-neutral", format, seed, size);
}
public string Croodles(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("croodles", format, seed, size);
}
public string CroodlesNeutral(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("croodles-neutral", format, seed, size);
}
public string Dylan(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("dylan", format, seed, size);
}
public string FunEmoji(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("fun-emoji", format, seed, size);
}
public string Glass(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("glass", format, seed, size);
}
public string Icons(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("icons", format, seed, size);
}
public string Identicon(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("identicon", format, seed, size);
}
public string Initials(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("initials", format, seed, size);
}
public string Lorelei(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("lorelei", format, seed, size);
}
public string LoreleiNeutral(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("lorelei-neutral", format, seed, size);
}
public string Micah(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("micah", format, seed, size);
}
public string Miniavs(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("miniavs", format, seed, size);
}
public string Notionists(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("notionists", format, seed, size);
}
public string NotionistsNeutral(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("notionists-neutral", format, seed, size);
}
public string OpenPeeps(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("open-peeps", format, seed, size);
}
public string Personas(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("personas", format, seed, size);
}
public string PixelArt(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("pixel-art", format, seed, size);
}
public string PixelArtNeutral(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("pixel-art-neutral", format, seed, size);
}
public string Rings(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("rings", format, seed, size);
}
public string Shapes(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("shapes", format, seed, size);
}
public string Thumbs(string format = "svg", string seed = null, int size = 64, int scale = 100)
{
return Avatar("thumbs", format, seed, size);
}
}
}