Skip to content

Commit

Permalink
Update readme (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
trejjam authored Aug 28, 2024
1 parent 9a98bb4 commit 05e8c46
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[![Build Status](https://github.com/aviationexam/apple-app-store-connect-api/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/aviationexam/apple-app-store-connect-api/actions/workflows/build.yml)
[![NuGet](https://img.shields.io/nuget/v/Aviationexam.Apple.AppStoreConnect.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/Aviationexam.Apple.AppStoreConnect/)
[![MyGet](https://img.shields.io/myget/apple-app-store-connect/vpre/Aviationexam.Apple.AppStoreConnect?label=MyGet)](https://www.myget.org/feed/apple-app-store-connect/package/nuget/Aviationexam.Apple.AppStoreConnect)
[![feedz.io](https://img.shields.io/badge/endpoint.svg?url=https%3A%2F%2Ff.feedz.io%2Faviationexam%2Fapple-app-store-connect-api%2Fshield%2FAviationexam.Apple.AppStoreConnect%2Flatest&label=Aviationexam.Apple.AppStoreConnect)](https://f.feedz.io/aviationexam/apple-app-store-connect-api/packages/Aviationexam.Apple.AppStoreConnect/latest/download)

# Apple AppStoreConnect
Expand All @@ -9,9 +8,14 @@
```xml
<ItemGroup>
<PackageReference Include="Aviationexam.Apple.AppStoreConnect" Version="" />
<PackageReference Include="Aviationexam.Apple.AppStoreConnect.DependencyInjection" Version="" />
</ItemGroup>
```
Note: Version is composed as `<Major>.<Minor>.<Patch>.<OpenApiMajor:00><OpenApiMinor:00><OpenApiPatch:00>[-<nightly[0-9]{4}>]`
e.g. `0.1.13.030500-nightly0008` means: source code version **0.1.13**, **8th** nightly build, AppStoreConnect version **3.5.0**

## Disclaimer

This library make some minor changes to the document, mainly to fix definition issues. You can examine the difference after restoring the project comparing `openapi.original.json` `openapi.json` located in the `src/Apple.AppStoreConnect/app-store-connect-openapi-specification`.

## How to configure library

Expand Down Expand Up @@ -39,25 +43,31 @@ serviceCollection.AddAppleAppStoreConnect(optionsBuilder => optionsBuilder
);
// 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
},
}
optionsBuilder => optionsBuilder.Configure()
);
```

## 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.
You can access all clients using the `AppStoreConnectApiClient`, e.g.:
```cs
var apiClient = serviceProvider.GetRequiredService<Apple.AppStoreConnect.Client.AppStoreConnectApiClient>();

var territoriesResponse = await apiClient.V1.Territories.GetAsync(
requestConfiguration: x =>
{
x.QueryParameters.Fieldsterritories =
[
GetFieldsTerritoriesQueryParameterType.Currency,
];
x.QueryParameters.Limit = PageSize;
},
cancellationToken
);

string appleAppId = "<id>";
var inAppPurchases = await apiClient.V1.Apps[appleAppId].InAppPurchasesV2.GetAsync(
x => x.QueryParameters.Limit = PageSize,
cancellationToken
);
```

0 comments on commit 05e8c46

Please sign in to comment.