Skip to content

Commit e77ea30

Browse files
committed
6.0.0. Update | Now Maintained
1 parent e05aa3d commit e77ea30

File tree

2,539 files changed

+620
-2636566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,539 files changed

+620
-2636566
lines changed

.gitattributes

Lines changed: 0 additions & 2 deletions
This file was deleted.

.gitignore

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
/bin
2-
/obj
3-
/bin/Debug
4-
/obj/Debug
5-
/bin/Release
6-
/obj/Release
7-
/.vs
8-
/FileContentIndex
1+
# Build artifacts
2+
bin/
3+
obj/
4+
5+
# Visual Studio-related files
6+
.vs/
97

8+
# Miscellaneous
9+
/FileContentIndex
1010
*.nupkg
1111
*.nuspec
12-
.vs/ScriptBloxAPI/v17/.suo
12+
*.suo
13+
*.user
14+
*.userosscache
15+
*.sln.docstates
16+
.qodo

.vs/ScriptBloxAPI/v17/.suo

-321 KB
Binary file not shown.

Backend Functions/MiscFunctions.cs

Lines changed: 0 additions & 113 deletions
This file was deleted.

Backend Functions/ScriptBloxException.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.

Client.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Net.Http;
5+
using System.Text.Json;
6+
using System.Threading.Tasks;
7+
8+
namespace ScriptBloxApi
9+
{
10+
internal class Client
11+
{
12+
private static readonly Lazy<HttpClient> LazyClient = new(() =>
13+
{
14+
HttpClient client = new()
15+
{
16+
Timeout = TimeSpan.FromSeconds(30)
17+
};
18+
client.DefaultRequestHeaders.Add("User-Agent", "IrisAgent ScriptBloxApi/1.0");
19+
client.DefaultRequestHeaders.Add("Accept", "application/json");
20+
return client;
21+
});
22+
23+
internal static HttpClient HttpClient => LazyClient.Value;
24+
25+
internal static async Task<T> Get<T>(string endpoint, Dictionary<string, string> queryParams)
26+
{
27+
string queryString = string.Join("&", queryParams.Select(kvp => $"{kvp.Key}={kvp.Value}"));
28+
29+
if (!string.IsNullOrEmpty(queryString))
30+
queryString = "?" + queryString;
31+
32+
HttpRequestMessage request = new(HttpMethod.Get, $"https://scriptblox.com/api/{endpoint}{queryString}");
33+
HttpResponseMessage response = await HttpClient.SendAsync(request);
34+
35+
if (!response.IsSuccessStatusCode)
36+
throw new Exception(
37+
$"Error fetching: {response.StatusCode}\n{await response.Content.ReadAsStringAsync()}");
38+
39+
string jsonResponse = await response.Content.ReadAsStringAsync();
40+
41+
if (typeof(T) == typeof(string))
42+
return (T)(object)jsonResponse;
43+
44+
return JsonSerializer.Deserialize<T>(jsonResponse);
45+
}
46+
}
47+
}

DataTypes/BoolStatus.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

DataTypes/CommentObject.cs

Lines changed: 0 additions & 40 deletions
This file was deleted.

DataTypes/GameObject.cs

Lines changed: 0 additions & 34 deletions
This file was deleted.

DataTypes/NotificationObject.cs

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)