Hub Service (HUB) Client Library

The client library allows consuming the service REST API.

Index

Service Client

Class Description
HubClient The entry point of the Hub Service client library.

^ Back to top

Controllers

Class Description
Geocoding Provides operations on geocoding.
Weather Provides operations on weather.

^ Back to top

Models

Class Description
GeoAddressData Describes a geo address.
GeometryData Describes a geometry.

^ Back to top

Enumerations

The client library has no enumerations.

^ Back to top

Authorization Policies

Policy Description Scope
DefaultScope Defines an authorization policy that requires the default scope. lithium-hub

^ Back to top

Reference

Service Client

HubClient

Constructors
HubClient(Uri, BearerTokenCredential)
Parameter Type Description
serviceUri Uri The service URI.
credential BearerTokenCredential The credential that should be used to access the service.
HubClient(Uri, BearerTokenCredential, HubClientOptions)
Parameter Type Description
serviceUri Uri The service URI.
credential BearerTokenCredential The credential that should be used to access the service.
clientOptions HubClientOptions The client options.
Example
Uri address = new Uri("[service-address]");
Uri authorizationServer = new Uri("[authorization-server]");
string clientId = "[client-id]"
string clientSecret = "[client-secret]"

HubClient client = new HubClient(
    new Uri(address),
    new ClientSecretCredential(
        authorizationServer,
        clientId,
        clientSecret));

^ Back to top

Error Codes

ErrorCodes

Constants
Constants Description Remarks
GeocodingInformationNotFound The geocoding information does not exist for the address.
GeocodingInformationNotRetrieved The geocoding information could not be retrieved for the specified address.
LocationsNotFound No locations found for the specified search term.
LocationsNotRetrieved The locations could not be retrieved for the specified search term.
RequestArgsInvalid The request arguments are invalid.
WeatherNotFound The weather information does not exist for the specified coordinate/location.
WeatherNotRetrieved The weather information could not be retrieved for the specified coordinate/location.

Controllers

GeocodingClientController

Provides operations on geocoding.

Methods
FindAddressAsync()

Retrieves geocoding information about the specified address.

public async Task<Cegid.Hydrogen.Rest.Client.RestServiceResult<Cegid.Lithium.Hub.Client.Rest.Models.GeoAddressData>> FindAddressAsync(string address, CancellationToken cancellationToken = default);
Parameters
Parameter Type Description Rules
address string The address. Required.
Returns
Return Type Description
Cegid.Lithium.Hub.Client.Rest.Models.GeoAddressData The geocoding information.
Status Codes
Status Code Description
HttpStatusCode.OK Success.

The operation will raise RestRequestException for any failure status code. The exception may include a body with an instance of RestProblemDetails depending on the status code.

^ Back to top

WeatherClientController

Provides operations on weather.

Methods
GetWeatherForCoordinateAsync()

Retrieves the weather for the specified coordinates.

public async Task<Cegid.Hydrogen.Rest.Client.RestServiceResult<string>> GetWeatherForCoordinateAsync(double latitude, double longitude, string? locationId, CancellationToken cancellationToken = default);
Parameters
Parameter Type Description Rules
latitude double The latitude. Required.
longitude double The longitude. Required.
locationId string? The location identifier. Required.
Returns
Return Type Description
string The weather for the specified coordinates.
Status Codes
Status Code Description
HttpStatusCode.OK Success.
HttpStatusCode.BadRequest Failure: the request is invalid.
HttpStatusCode.NotFound Failure: not found.
HttpStatusCode.Conflict Failure: conflict.

The operation will raise RestRequestException for any failure status code. The exception may include a body with an instance of RestProblemDetails depending on the status code.

^ Back to top

GetWeatherForLocationAsync()

Retrieves the weather for the specified location.

public async Task<Cegid.Hydrogen.Rest.Client.RestServiceResult<string>> GetWeatherForLocationAsync(string city, string locationId, CancellationToken cancellationToken = default);
Parameters
Parameter Type Description Rules
city string The location city. Required.
locationId string The location identifier. Required.
Returns
Return Type Description
string The weather for the specified location.
Status Codes
Status Code Description
HttpStatusCode.OK Success.

The operation will raise RestRequestException for any failure status code. The exception may include a body with an instance of RestProblemDetails depending on the status code.

^ Back to top

SearchLocationsAsync()

Retrieves a list of locations for the specified search term.

public async Task<Cegid.Hydrogen.Rest.Client.RestServiceResult<System.Collections.Generic.IDictionary<string, string>>> SearchLocationsAsync(string searchTerm, string locationId, CancellationToken cancellationToken = default);
Parameters
Parameter Type Description Rules
searchTerm string The search term. Required.
locationId string The location identifier. Required.
Returns
Return Type Description
System.Collections.Generic.IDictionary<string, string> The list of locations.
Status Codes
Status Code Description
HttpStatusCode.OK Success.

The operation will raise RestRequestException for any failure status code. The exception may include a body with an instance of RestProblemDetails depending on the status code.

^ Back to top

Models

GeoAddressData

Describes a geo address.

Properties
Property Type Description Rules
FormattedAddress string? Gets or sets the formatted address.
Street string? Gets or sets the street.
StreetNumber string? Gets or sets the street number.
PostalCode string? Gets or sets the postal code.
Locality string? Gets or sets the locality.
Country string? Gets or sets the country.
OtherProperties System.Collections.Generic.IDictionary<string, string>? Gets or sets the other properties.
Geometry Cegid.Lithium.Hub.Client.Rest.Models.GeometryData Gets or sets the geometry. Required.

^ Back to top

GeometryData

Describes a geometry.

Properties
Property Type Description Rules
Latitude double Gets or sets the latitude. Required.
Longitude double Gets or sets the longitude. Required.

^ Back to top