Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nailyjs/nest-apple-app-store
π Apple App Store Node.js Server SDK for Nest.js Nest.jsηθΉζ App Store Node.jsζε‘η«―SDK
https://github.com/nailyjs/nest-apple-app-store
app-store app-store-server-api apple nest nest-module nestjs nestjs-backend nestjs-module
Last synced: about 1 month ago
JSON representation
π Apple App Store Node.js Server SDK for Nest.js Nest.jsηθΉζ App Store Node.jsζε‘η«―SDK
- Host: GitHub
- URL: https://github.com/nailyjs/nest-apple-app-store
- Owner: nailyjs
- License: apache-2.0
- Created: 2024-01-26T16:30:25.000Z (10 months ago)
- Default Branch: v1
- Last Pushed: 2024-01-26T19:17:10.000Z (10 months ago)
- Last Synced: 2024-09-28T13:42:51.135Z (about 2 months ago)
- Topics: app-store, app-store-server-api, apple, nest, nest-module, nestjs, nestjs-backend, nestjs-module
- Language: TypeScript
- Homepage: https://github.com/nailyjs/nest-apple-app-store
- Size: 377 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Apple App Store Server SDK for Nest.js π
[δΈζ](./README_CN.md) | English
## Introduction π
This is a Nest.js SDK for Apple App Store Server API. It is based on [apple-app-store-api](https://github.com/apple/app-store-server-library-node).
It is a Nest.js module that can be easily integrated into Nest.js projects.
## Install π¦
`npm`γ`yarn`γ`pnpm` are all supported. Recommend `pnpm`.
```bash
pnpm add @nailyjs.nest.modules/app-store @apple/app-store-server-library
```## Usage π
### Basic Usage πΌ
```typescript
import { Module } from "@nestjs/common";
import { AppleAppStoreModule } from "@nailyjs.nest.modules/app-store";@Module({
imports: [
AppleAppStoreModule.register({
// If true, the module can be used across all modules.
global: true,
clients: {
provide: APP_STORE_SERVER_API_CLIENT,
signingKey: "",
issuerId: "",
bundleId: "",
keyId: "",
environment: Environment.SANDBOX,
},
}),
],
})
export class AppModule {}
```In your service, you can directly inject the `AppStoreServerAPIClient` instance.
```typescript
import { Injectable } from "@nestjs/common";
import { AppStoreServerAPIClient } from "@apple/app-store-server-library";@Injectable()
export class AppStoreService {
constructor(private readonly appStoreServerAPIClient: AppStoreServerAPIClient) {}// ...
}
```> `AppStoreServerAPIClient` is imported from official package `@apple/app-store-server-library`.
### Async Usage π
```typescript
import { Module } from "@nestjs/common";
import { AppleAppStoreModule } from "@nailyjs.nest.modules/app-store";
import { Environment } from "@apple/app-store-server-library";@Module({
imports: [
AppleAppStoreModule.registerAsync({
// If true, the module can be used across all modules.
global: true,
clients: {
inject: [],
useFactory: () => {
return {
signingKey: "",
issuerId: "",
bundleId: "",
keyId: "",
environment: Environment.SANDBOX,
};
},
},
}),
],
})
export class AppModule {}
```### Multiple Clients π
Also can use multiple async clients. The following example shows how to use multiple general clients.
```typescript
import { Module } from "@nestjs/common";
import { AppleAppStoreModule } from "@nailyjs.nest.modules/app-store";
import { Environment } from "@apple/app-store-server-library";export const APP_STORE_SERVER_API_CLIENT_ONE = Symbol("APP_STORE_SERVER_API_CLIENT_ONE");
export const APP_STORE_SERVER_API_CLIENT_TWO = Symbol("APP_STORE_SERVER_API_CLIENT_TWO");@Module({
imports: [
AppleAppStoreModule.register({
// If true, the module can be used across all modules.
global: true,
clients: [
{
provide: APP_STORE_SERVER_API_CLIENT_ONE,
signingKey: "",
issuerId: "",
bundleId: "",
keyId: "",
environment: Environment.SANDBOX,
},
{
provide: APP_STORE_SERVER_API_CLIENT_TWO,
signingKey: "",
issuerId: "",
bundleId: "",
keyId: "",
environment: Environment.PRODUCTION,
},
],
}),
],
})
export class AppModule {}
```In your service, you can inject the exported `APP_STORE_SERVER_API_CLIENT_ONE` or `APP_STORE_SERVER_API_CLIENT_TWO` symbol.
```typescript
import { Injectable } from "@nestjs/common";
import { AppStoreServerAPIClient } from "@apple/app-store-server-library";
import { APP_STORE_SERVER_API_CLIENT_ONE } from "./app.module";@Injectable()
export class AppStoreService {
constructor(
@Inject(APP_STORE_SERVER_API_CLIENT_ONE)
private readonly appStoreServerAPIClientOne: AppStoreServerAPIClient,
@Inject(APP_STORE_SERVER_API_CLIENT_TWO)
private readonly appStoreServerAPIClientTwo: AppStoreServerAPIClient,
) {}// ...
}
```## Author π¨βπ»
### Zero
- [GitHub](https://github.com/groupguanfang)
- [QQ](1203970284)## Donate βοΈ
If you find this project useful, you can buy author a glass of coffee π₯°
![wechat](./screenshots/wechat.jpg)
![alipay](./screenshots/alipay.jpg)