Fireflies.GraphQL.Client.Console 1.4.10

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global Fireflies.GraphQL.Client.Console --version 1.4.10
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local Fireflies.GraphQL.Client.Console --version 1.4.10
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Fireflies.GraphQL.Client.Console&version=1.4.10
                    
nuke :add-package Fireflies.GraphQL.Client.Console --version 1.4.10
                    

Fireflies GraphQL client generator

The generated generates files from a schema and does not add external dependencies to your project.

Install the tool

Globally

dotnet tool install --global Fireflies.GraphQL.Client.Console

Locally

dotnet tool install Fireflies.GraphQL.Client.Console

Init a project

Basically creates a GraphQL in your project and add general generation settings to Settings.json.

fireflies-graphql init --path path-to-root-of-project --namespace MyProject.Api.GraphQL --service-collection

Init a client

Downloads the schema and stores it into a sub-folder inside the GraphQL.

fireflies-graphql add --name MyProject --path path-to-project --uri https://localhost:7273/graphql

Update the schema

fireflies-graphql update --name MyProject --path path-to-project

Add your GraphQL queries

Under the GraphQL\MyProject folder you can now add .graphql files that will be used to generate the client.

query GetBook($bookId: Int!) {
	getBook(bookId: $bookId) {
		...TitleFragment
	}
}

fragment TitleFragment on IBook {
	title
	... on InventoryBook {
		calculatePrice
		editions {
			name
			released
		}
	}
	... TestFragment
}

fragment TestFragment on RemoteBook {
	test
}

subscription BookUpdated($bookId: Int!) {
  bookUpdated(bookId: $bookId) {
    title
	bookId
    __typename
  }
}

Generate all clients

fireflies-graphql generate --path path-to-project

Using the client

Setup the client

var client = new MyProjectClient(b => {
    b.Uri = new Uri("https://localhost:7273/graphql");
}, b => {
    b.Uri = new Uri("wss://localhost:7273/graphql");
    b.ReconnectDelay = TimeSpan.FromSeconds(5);
});

Performing a query

var bookResult = await client.GetBook(123);
var book = bookResult.Data;

Subscribe to a subscription

var watcher = await client.BookUpdated(123).Watch(m => {
    Console.WriteLine($"{m.Data.BookUpdated.BookId} was updated {m.Data.BookUpdated.Title}");
});

Once you´re done with your subscription make sure to dispose it.

await watcher.DisposeAsync();

Logo by freepik

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

This package has no dependencies.

Version Downloads Last Updated
1.18.2 197 1/28/2025
1.18.1 204 11/14/2024
1.18.0 336 2/14/2024
1.17.0 334 11/15/2023
1.16.1 307 10/9/2023
1.16.0 302 9/4/2023
1.15.2 362 8/23/2023
1.15.1 330 8/22/2023
1.15.0 336 8/22/2023
1.14.22 239 7/14/2023
1.14.21 259 7/14/2023
1.14.20 239 7/13/2023
1.14.19 243 7/13/2023
1.14.18 238 7/12/2023
1.14.17 217 7/12/2023
1.14.16 252 7/11/2023
1.14.15 213 7/10/2023
1.4.14 236 7/4/2023
1.4.13 232 6/28/2023
1.4.10 277 6/28/2023
Loading failed