Replit.GraphQL 1.0.0

dotnet add package Replit.GraphQL --version 1.0.0
NuGet\Install-Package Replit.GraphQL -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Replit.GraphQL" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Replit.GraphQL --version 1.0.0
#r "nuget: Replit.GraphQL, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Replit.GraphQL as a Cake Addin
#addin nuget:?package=Replit.GraphQL&version=1.0.0

// Install Replit.GraphQL as a Cake Tool
#tool nuget:?package=Replit.GraphQL&version=1.0.0

Replit

alternate text is missing from this package README image

An async and lightweight C# library for interacting with Replit APIs.

Usage

Provides an easy interface for interacting with Replit APIs. Currently distributed packages:

  • Replit.GraphQL (NuGet) (GitHub) - Wrapper for the GraphQL API.

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 browser Developer Tools while 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 6 and .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

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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 216 11/13/2022