Skip to content

Commit

Permalink
API home page
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed May 26, 2021
1 parent e083b45 commit fddef27
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions docs/api/index.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# PLACEHOLDER
TODO: Add .NET projects to the *src* folder and run `docfx` to generate **REAL** *API Documentation*!
# DotNetStac API

Main entry point API is `StacConvert.Deserialize<IStacObject>`, which deserializes a Stac Object (Catalog, COllection or Item) that implements `IStacObject`:

```csharp
using Stac;
using Stac.Schemas;
using System;
using System.Net;
using Newtonsoft.Json.Schema;

var webc = new WebClient();
Uri catalogUri = new Uri("https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/catalog.json");
StacValidator stacValidator = new StacValidator(new JSchemaUrlResolver());

// StacConvert.Deserialize is the helper to start loading any STAC document
var json = webc.DownloadString(catalogUri);
bool valid = stacValidator.ValidateJson(json);
StacCatalog catalog = StacConvert.Deserialize<StacCatalog>(json);

Console.Out.WriteLine(catalog.Id + ": " + catalog.Description + (valid ? " [VALID]" : "[INVALID]"));
Console.Out.WriteLine(catalog.StacVersion);
```

0 comments on commit fddef27

Please sign in to comment.