-
Notifications
You must be signed in to change notification settings - Fork 9
Migration Guide
Updating to v1
might break existing code.
PR #50, PR #54 and PR #59 introduced important changes to the API. Two new services IHealthService
and IMetricsService
have been added and related methods on IBlockfrostService
have been extracted into these interfaces. See Appendix A for an overview of the affected methods.
Additionally outdated model and service classes have been removed. Please review your existing implementations and update your source code to use the new Service Interfaces (pluralized service names).
To reflect the blockfrost.io OpenApi Specification more closely, a new set of Models and Service interfaces have been introduced.
// old
public partial class AccountService : IAccountService { }
// new
public partial class AccountsService : IAccountsService {
public IHealthService Health { get; set; }
public IMetricsService Metrics { get; set; }
}
Method signatures on the old services have been inferred from the API operations return types, leading to ambiguity (i.e. IAccountService.Delegations2Async
):
Method signatures on the new services are inferred from the API endpoint's path:
// Endpoint: /accounts/{stake_address}/addresses
// old
Task<ICollection<StakeAddressesAddressesResponse>> AddressesAllAsync(string stake_address, int? count, int? page, ESortOrder? order);
// new
Task<AccountAddressesContentResponseCollection> GetAddressesAsync(string stake_address, int? count, int? page, ESortOrder? order);
// the return type derives Collection>T> of the response content's item schema
public partial class AccountAddressesContentResponseCollection : Collection<AccountAddressesContentResponse> { }
Please update your code accordingly.
In v1, every method has cancellation support.
public partial interface IBlockfrostService
{
string Network { get; }
Task<InfoResponse> GetInfoAsync();
Task<ClockResponse> GetClockAsync();
Task<HealthResponse> GetHealthAsync();
Task<ICollection<MetricResponse>> GetMetricsAsync();
Task<ICollection<MetricsEndpointResponse>> EndpointsAsync();
}
interface IHealthService
{
Task<ApiInfoResponse> GetApiInfoAsync();
Task<HealthResponse> GetHealthAsync();
Task<HealthClockResponse> GetHealthClockAsync();
}
interface IMetricsService
{
Task<MetricsResponseCollection> GetMetricsAsync();
Task<MetricsEndpointsResponseCollection> GetEndpointsAsync();
}
interface IBlockfrostService
{
string Network { get; set; }
string BaseUrl { get; set; }
bool ReadResponseAsString { get; set; }
}
docs.blockfrost.io | OpenApi Specification | NuGet Packages
Forget this world and all its troubles and if possible its multitudinous Charlatans-- everything in short but the Enchantress of Numbers.
-- Ada Lovelace