Skip to content

V0.0.7 - Creators

Compare
Choose a tag to compare
@liebki liebki released this 26 Dec 15:15
· 10 commits to master since this release
7db814d

Hi, now you can use RawgNet, to get creators, the next step for RawgNet of many to come.
Furthermore, now all methods are async, you decide if you use them that way tho.

Examples down below:

Getting a list with 99 creators, (of all known 26385) - I don't recommend getting all, because it takes very long

using (RawgClient client = new(new ClientOptions("YOUR KEY FROM https://rawg.io/login?forward=developer")))
{
	int count = 99;
	List<Creator> creators = await client.GetCreators(count);
	
	for (int i = 0; i < count; i++)
	{
		Console.WriteLine(creators[i].Name);
	}
}

Getting a creator

using (RawgClient client = new(new ClientOptions("YOUR KEY FROM https://rawg.io/login?forward=developer")))
{
	string creatorid = "2612";
	Creator cr = await client.GetCreator(creatorid);

	Console.WriteLine(cr.ToString());
}

Getting a bool, if a creator exists with the wanted creatorid

using (RawgClient client = new(new ClientOptions("YOUR KEY FROM https://rawg.io/login?forward=developer")))
{
	string creatorid = "26386";
	bool Exist = await client.IsCreatorExisting(creatorid);

	if(Exist)
	{
		Creator cr = await client.GetCreator(creatorid);
		Console.WriteLine(cr.Name);
	}
}

But there is a bool, that should indicate without needing IsCreatorExisting in the creator object, when using GetCreator, you can look for the bool "IsCreatorExisting".