Skip to content

aviationexam/apple-app-store-connect-api

Repository files navigation

Build Status NuGet MyGet feedz.io

Apple AppStoreConnect

Install

<ItemGroup>
    <PackageReference Include="Aviationexam.Apple.AppStoreConnect" Version="" />
    <PackageReference Include="Aviationexam.Apple.AppStoreConnect.DependencyInjection" Version="" />
</ItemGroup>

How to configure library

Add library to the dependency container

using Aviationexam.Apple.AppStoreConnect.DependencyInjection;

IServiceCollection serviceCollection;

// you may need to add these dependencies
serviceCollection.AddMemoryCache();
using System;
serviceCollection.TryAddSingleton<TimeProvider>(TimeProvider.System);

// configure AppStoreConnect services
serviceCollection.AddAppleAppStoreConnect(optionsBuilder => optionsBuilder
  .Configure()
  .ValidateDataAnnotations()
);
// OR
serviceCollection.AddAppleAppStoreConnect(optionsBuilder => optionsBuilder
  .Bind(builder.Configuration.GetSection(MyConfigOptions.MyConfig))
  .ValidateDataAnnotations()
);
// OR
serviceCollection.AddAppleAppStoreConnect(
  optionsBuilder => optionsBuilder.Configure(),
  new Dictionary<Type, Action<IHttpClientBuilder>> {
    [typeof(IAppStoreConnectClient)] = httpClientBuilder => {
      // here you can configure all managed http clients
    },

    [typeof(IAgeRatingDeclarationsClient)] = httpClientBuilder => {
      // or you can configure one specific http client
    },
  }
);

How to use library

There are many clients generated from openapi.json. This library make some minor changes to the document, mainly to improve quality of generated client or to fix some issues.

Generated clients follows naming convention: I{tags.first}Client, you can simply access it using dependency injection or from your service provider.