From 8da0c3a2ba9754b7c6f6a9604c1811b41188a0b6 Mon Sep 17 00:00:00 2001 From: Andrew Farquharson Date: Thu, 2 Nov 2023 15:00:44 +1300 Subject: [PATCH] Update README.md --- README.md | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7baffaf..770eeed 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,39 @@ -# rc-kit -Vapor tool kit for RevenueCat +# RCKit +RCKit is a simple tool kit to add basic RevenueCat support to your Vapor server. + +It currently only supports the [V1 API](https://www.revenuecat.com/reference/subscribers) for getting or creating a subscriber and webhooks. + +PRs welcome :) + +#### Config + +```swift +import RCKit + +public func configure(_ app: Application) throws { + app.revenueCat.configuration = .init(token: "") +} + +``` + +#### Get or Create Subscriber + +```swift + +struct YourEntitlements: Content { + let pro: RCEntitlement? +} + +let subscriber: RCSubscriber = try await req.application.revenueCat.getSubscriber("") +... + +``` + +#### Webhook + +```swift +func post(_ req: Request) async throws -> HTTPStatus { + let eventBody: RCEventBody = try req.content.decode(RCEventBody.self) + ... +} +```