Skip to content

LawPanel/ApiClient.DotNet

Repository files navigation

Logo and name

Build

This project contains a Portable Class Library containing a typed .NET client gateway for accessing LawPanel's Firms REST API.

Features

  • Small, typed, message-based API uses only clean DTO's
  • Portable profile available supporting .NET 4.5, ASP.NET Core 1.0, Windows 8, Xamarin.Android, Xamarin.iOS clients

Install LawPanel.ApiClient.DotNet

Install from NuGet with:

PM> Install-Package LawPanel.ApiClient.DotNet

Includes Portable Version (.NET 4.5, ASP.NET Core 1.0, Windows 8, Xamarin.Android, Xamarin.iOS)

Usage

Requires a registered LawPanel API Key, e.g:

var lawpanel = new LawPanelClient("8a5536dc-6d34-4f4a-8cac-a67201481ca0");

Some API methods requires, in addition to the API Key, the authentication at level user.

So, you can call the constructor as below:

var lawpanel = new LawPanelClient("8a5536dc-6d34-4f4a-8cac-a67201481ca0","user@domain.ext","password");

Request and return DTO's are just clean POCO's, e.g:

public class SearchDto : Dto, IIdentifiableDto
{
  public string               Id          { get; set; }
  public string               SearchTerm  { get; set; }
  public string               Classes     { get; set; }
  public DateTime             StartTime   { get; set; }
  public DateTime             EndTime     { get; set; }
  public int                  Score       { get; set; }
  public string               Weightings  { get; set; }
  public SearchType           Type        { get; set; }
  public TrademarkRegistry    Registry    { get; set; }
  public SearchStatus         Status      { get; set; }
  public string               StatusText  { get; set; }
}

Documentation

These API examples follows LawPanel's Firm API Documentation.

Pagination

If you are getting lists of entities using the READ methods (i.e. ReadSearchClasses) can filter results using the optional parameters skip and take.

By example, to skip the first 5 search classes and get the next 10:

var searchClasses = lawpanel.ReadSearchClasses(5, 10);

If you do not specify these parameters, will receive all entities: the API client will execute all calls required to get all entities.

Ordering

You can set the order for the results specifying the field names and the order direction. By example:

var searchClasses = lawpanel.ReadSearchClasses(order: new List<ColumnOrder> { 
  new ColumnOrder { Name = "name", Direction = OrderDirection.Desc } 
});

Will returns all search classes ordered by the field name in descending ordering.

Important: all field names should be writen with the snake_case convention.

By example, if the field name is Name should be name, if it is SearchClasses you should write it as search_classes, etc.

Examples

Creating a new trademark search

var search = lawpanel.CreateSearch(new SearchQuery
{
    Classes = "3,25,15",
    Registry = "UK",
    SearchTerm = "lawpanel"
});

Retrieving a Search status

var searchStatus = lawpanel.GetStatus(search.Id);