Add test project, create nuget package

This commit is contained in:
Ian Webster 2020-11-26 18:25:58 -05:00
parent bdf3c2b4b6
commit 889a182f0f
6 changed files with 117 additions and 10 deletions

View file

@ -56,6 +56,10 @@ namespace QuickChart
queryString.Add("devicePixelRatio", DevicePixelRatio.ToString());
queryString.Add("bkg", BackgroundColor);
queryString.Add("c", Config);
if (!string.IsNullOrEmpty(Key))
{
queryString.Add("key", Key);
}
return $"{Protocol}://{Host}:{Port}/chart?{queryString}";
}
@ -67,6 +71,9 @@ namespace QuickChart
throw new NullReferenceException("You must set Config on the QuickChart object before generating a URL");
}
JsonSerializerOptions options = new JsonSerializerOptions();
options.IgnoreNullValues = true;
String json = JsonSerializer.Serialize(new
{
width = Width,
@ -74,9 +81,8 @@ namespace QuickChart
backgroundColor = BackgroundColor,
devicePixelRatio = DevicePixelRatio,
chart = Config,
});
// TODO(ian): key
key = Key,
}, options);
string url = $"{Protocol}://{Host}:{Port}/chart/create";
@ -102,6 +108,9 @@ namespace QuickChart
throw new NullReferenceException("You must set Config on the QuickChart object before generating a URL");
}
JsonSerializerOptions options = new JsonSerializerOptions();
options.IgnoreNullValues = true;
String json = JsonSerializer.Serialize(new
{
width = Width,
@ -109,9 +118,8 @@ namespace QuickChart
backgroundColor = BackgroundColor,
devicePixelRatio = DevicePixelRatio,
chart = Config,
});
// TODO(ian): key
key = Key,
}, options);
string url = $"{Protocol}://{Host}:{Port}/chart";

View file

@ -3,6 +3,18 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PackOnBuild>true</PackOnBuild>
<Authors>Ian Webster</Authors>
<Copyright>Ian Webster 2020</Copyright>
<PackageLicenseUrl>https://github.com/typpo/quickchart-csharp/blob/main/LICENSE</PackageLicenseUrl>
<Owners>QuickChart</Owners>
<PackageProjectUrl>https://github.com/typpo/quickchart-csharp</PackageProjectUrl>
<Summary>Client library for the QuickChart Chart API, used to generate chart images.</Summary>
<PackageTags>chart image, chart api, chart, charts</PackageTags>
<Title>QuickChart</Title>
<Description>Client library for the QuickChart Chart API, used to generate chart images.</Description>
<PackageVersion>1.0.0</PackageVersion>
<PackageId>QuickChart</PackageId>
</PropertyGroup>
</Project>