BNBParty.GraphQLClient
1.0.2
See the version list below for details.
dotnet add package BNBParty.GraphQLClient --version 1.0.2
NuGet\Install-Package BNBParty.GraphQLClient -Version 1.0.2
<PackageReference Include="BNBParty.GraphQLClient" Version="1.0.2" />
paket add BNBParty.GraphQLClient --version 1.0.2
#r "nuget: BNBParty.GraphQLClient, 1.0.2"
// Install BNBParty.GraphQLClient as a Cake Addin #addin nuget:?package=BNBParty.GraphQLClient&version=1.0.2 // Install BNBParty.GraphQLClient as a Cake Tool #tool nuget:?package=BNBParty.GraphQLClient&version=1.0.2
BNBParty.GraphQL
BNBParty.GraphQL is a library for interacting with BNBParty.GraphQL project's GraphQL endpoint. It allows you to perform queries to the GraphQL server and retrieve data.
Installation
Clone the repository:
dotnet add package BNBParty.GraphQLClient
Usage
- Add necessary packages:
dotnet add package Flurl.Http dotnet add package Newtonsoft.Json
- Create a new instance of the GraphQlClient class with the endpoint.
Example Usage
Here is a basic example of how to use the library to perform queries to the GraphQL server:
using BNBParty.GraphQLClient;
using BNBParty.CodeGen.Generated.Types;
using System;
using System.Threading.Tasks;
namespace GraphQLClient.Test
{
class Program
{
static async Task Main(string[] args)
{
var endpoint = "https://origin/graphql";
var apiKey = "origin";
var client = new GraphQlClient(endpoint, apiKey);
try
{
// Example of GetToken query
var getTokenResponse = await client.GetTokenAsync(3);
if (getTokenResponse?.data?.getToken != null)
{
var token = getTokenResponse.data.getToken;
Console.WriteLine($"Token ID: {token.tokenId}");
Console.WriteLine($"Token Address: {token.tokenAddress}");
}
// Example of InsertToken mutation
var chainId = 97;
var txHash = "0x212d6de7f588b193a492ff89faa387806cdca26bb5a07ff1ce860d9d0630d285";
var insertTokenResponse = await client.InsertTokenAsync(chainId, txHash);
Console.WriteLine($"Inserted Token ID: {insertTokenResponse.data.insertToken.tokenId}");
Console.WriteLine($"Is New: {insertTokenResponse.data.insertToken.isNew}");
// Example of GenerateAuth mutation
var generateAuthResponse = await client.GenerateAuthAsync("someSign", "someMessage");
Console.WriteLine($"Generated Auth: {generateAuthResponse.data.generateAuth}");
// Example of UpdateTokenContent mutation
var tokenToUpdate = new Token
{
tokenId = 123,
offChainData = new OffChainData
{
content = "new content",
icon = "new icon",
likeCounter = 10,
Discord = "discord_link",
Telegram = "telegram_link",
Website = "website_link",
X = "x_link"
}
};
var updateTokenContentResponse = await client.UpdateTokenContentAsync(tokenToUpdate);
Console.WriteLine($"Updated Token ID: {updateTokenContentResponse.data.updateTokenContent.tokenId}");
Console.WriteLine($"Updated Content: {updateTokenContentResponse.data.updateTokenContent.offChainData.content}");
// Example of Login mutation
var loginResponse = await client.LoginAsync("someSign", "someMessage");
if (loginResponse)
{
Console.WriteLine("Login successful");
}
else
{
Console.WriteLine("Login failed");
}
// Example of Logout mutation
var logoutResponse = await client.LogoutAsync("someSign");
if (logoutResponse)
{
Console.WriteLine("Logout successful");
}
else
{
Console.WriteLine("Logout failed");
}
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
Methods
GetTokenAsync Query to retrieve information about a token by its ID.
public async Task<GetTokenResponse> GetTokenAsync(int tokenId);
InsertTokenAsync Mutation to insert a new token.
public async Task<InsertTokenResponse> InsertTokenAsync(long chainId, string txHash);
GenerateAuthAsync Mutation to generate an authorization token.
public async Task<GenerateAuthResponse> GenerateAuthAsync(string sign, string message);
UpdateTokenContentAsync Mutation to update the content of a token.
public async Task<UpdateTokenContentResponse> UpdateTokenContentAsync(Token token);
LoginAsync Mutation to login and generate an authorization token.
public async Task<bool> LoginAsync(string sign, string message);
LogoutAsync Mutation to logout and delete the authorization token.
public async Task<bool> LogoutAsync(string sign);
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 was computed. 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. |
-
net6.0
- Flurl.Http (>= 4.0.2)
- Net.Web3.EthereumWallet (>= 1.1.1)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Release Notes for BNBParty.GraphQLClient v1.0.2: