Replit.GraphQL
1.0.0
dotnet add package Replit.GraphQL --version 1.0.0
NuGet\Install-Package Replit.GraphQL -Version 1.0.0
<PackageReference Include="Replit.GraphQL" Version="1.0.0" />
<PackageVersion Include="Replit.GraphQL" Version="1.0.0" />
<PackageReference Include="Replit.GraphQL" />
paket add Replit.GraphQL --version 1.0.0
#r "nuget: Replit.GraphQL, 1.0.0"
#:package Replit.GraphQL@1.0.0
#addin nuget:?package=Replit.GraphQL&version=1.0.0
#tool nuget:?package=Replit.GraphQL&version=1.0.0
Replit
![]()
An async and lightweight C# library for interacting with Replit APIs.
Usage
Provides an easy interface for interacting with Replit APIs. Currently distributed packages:
To get started, add the library into your solution with either the NuGet Package Manager or the dotnet CLI.
dotnet add package Replit.GraphQL
For the primary classes to become available, import the used namespace.
using Replit.GraphQL;
Warning Certain actions require you to pass a valid session identifier (
connect.sid) cookie. You can obtain this from the browserDeveloper Toolswhile logged in. Unsure of how to obtain this value? See this guide written by RayhanADev. If you are on mobile, you can alternatively use this web based form made by IroncladDev.
Features
- Built for
.NET 6and.NET 7 - Fully async
- Extensive XML documentation
- No external dependencies (uses integrated HTTP and JSON)
- Custom exceptions for advanced catching
- Execute single or bulk Replit GraphQL queries
Example
Under the Example directory you can find a working demo project that implements this library.
Code Samples
Initializing a new GraphQL client with a valid session identifier cookie
string sid = "s%3Bew5ttAQuBlAANjIh8ABSoTTtZ75-7AbH.ohRBI9wNPwOHED7GLltPBrOS975gxqATe1aL6y%9N3%2Fla";
ReplitGraphQLClient client = new(sid, "Example Application");
Executing a single query
string userByUsername = @"
query userByUsername($username: String!) {
user: userByUsername(username: $username) {
id
bio
firstName
lastName
timeCreated
}
}";
User user = (await client.Execute<UserContainer>(userByUsername, new Dictionary<string, object>()
{
{
"username", "akac"
}
}))?.User;
Executing bulk queries
Repl[] repls = (await client.BulkExecute<ReplContainer>(new GraphQLParameters[]
{
new(replByUrl, new() { { "url", "https://replit.com/@amasad/TroubledPersonalBaitware" } }),
new(replByUrl, new() { { "url", "https://replit.com/@amasad/my-fun-new-app" } }),
new(replByUrl, new() { { "url", "https://replit.com/@amasad/comic-sans" } })
}))?.Select(data => data.Repl).ToArray();
Console.WriteLine($"Retrieved {repls.Length} repls back");
foreach (Repl repl in repls) Console.WriteLine($"=> {repl.Title} ({repl.Id}) was created at {repl.TimeCreated}");
Available Methods
- Task<GraphQLContainer[]> BulkExecuteRaw(GraphQLParameters[] parameters, JsonSerializerOptions options = null)
- Task<GraphQLContainer> ExecuteRaw(string query, Dictionary<string, object> variables = null, string operationName = null, JsonSerializerOptions options = null)
- Task<T[]> BulkExecute<T>(GraphQLParameters[] parameters, bool suppressErrors = false, JsonSerializerOptions options = null)
- Task<T> Execute<T>(string query, Dictionary<string, object> variables = null, bool suppressErrors = false, string operationName = null, JsonSerializerOptions options = null)
References
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 389 | 11/13/2022 |