Skip to content

Commit 123873f

Browse files
github-actions[bot]stigi
authored andcommitted
chore: Improve doc and code generation + ci workflows
1 parent 37a6bd4 commit 123873f

File tree

422 files changed

+7315
-2158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

422 files changed

+7315
-2158
lines changed

.changeset/auto-bump-magicbell-swift-client-1734410826.md

-5
This file was deleted.

.changeset/early-paws-marry.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"magicbell-swift-client": patch
3+
---
4+
5+
Adjusts generations scripts for documentation and code

.changeset/sixty-flowers-lay.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"magicbell-swift-client": patch
3+
---
4+
5+
Adds release discussion workflow

.github/workflows/regen.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ jobs:
2626

2727
- name: Build SourceDocs
2828
run: |
29-
git clone https://github.com/stigi/SourceDocs.git --branch xcode16 /tmp/sourcedocs
29+
git clone https://github.com/magicbell/SourceDocs.git --branch magicbell /tmp/sourcedocs
3030
pushd /tmp/sourcedocs
31-
make
31+
make build
32+
cp .build/release/sourcedocs /usr/local/bin
3233
popd
3334
3435
- name: Regen `magicbell-java-client`
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Release To Discussions
2+
3+
on:
4+
release:
5+
types: [created, edited, deleted]
6+
7+
concurrency: release-discussion-action
8+
9+
jobs:
10+
publish-release-notes:
11+
name: Publish Release Notes
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: publish discussion
16+
uses: magicbell/release-discussion-action@main
17+
with:
18+
repo: magicbell/community
19+
category: changelog
20+
cycle: week
21+
release-prefix: magicbell-swift-clilent
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.BELLA_ACTION_TOKEN }}

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
# magicbell-swift-client
2+
3+
## 0.1.0
4+
5+
### Minor Changes
6+
7+
- [#2](https://github.com/magicbell/magicbell-swift-client/pull/2) [`b2ed87d`](https://github.com/magicbell/magicbell-swift-client/commit/b2ed87df1b3b1e52a237e720eae6510dd8f9e3f7) Thanks [@MagicBella](https://github.com/MagicBella)! - Automatic minor version bump for changes in `magicbell-swift-client`.

README.md

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# MagicBellClient Swift SDK 0.1.0
2+
3+
Welcome to the MagicBellClient SDK documentation. This guide will help you get started with integrating and using the MagicBellClient SDK in your project.
4+
5+
## About the API
6+
7+
OpenAPI 3.0.3 Specification for MagicBell API.
8+
9+
## Table of Contents
10+
11+
- [MagicBellClient Swift SDK 0.1.0](#magicbellclient-swift-sdk-010)
12+
- [About the API](#about-the-api)
13+
- [Table of Contents](#table-of-contents)
14+
- [Setup \& Configuration](#setup--configuration)
15+
- [Supported Language Versions](#supported-language-versions)
16+
- [Installation](#installation)
17+
- [CocoaPods](#cocoapods)
18+
- [Swift Package Manager](#swift-package-manager)
19+
- [Authentication](#authentication)
20+
- [Access Token Authentication](#access-token-authentication)
21+
- [Setting the Access Token](#setting-the-access-token)
22+
- [Sample Usage](#sample-usage)
23+
- [License](#license)
24+
25+
# Setup & Configuration
26+
27+
## Supported Language Versions
28+
29+
This SDK is compatible with the following versions:
30+
31+
- iOS 13.0+, macOS 15.0+, tvOS 13.0+, watchOS 6.0+, visionOS 1.0+
32+
- Swift 6.0+
33+
- Xcode 16+
34+
35+
## Installation
36+
37+
38+
39+
### CocoaPods
40+
41+
If you use [CocoaPods](https://cocoapods.org), place the following within your `Podfile`:
42+
43+
```ruby
44+
pod 'MagicBellClient', '>=0.1.0'
45+
```
46+
47+
**IMPORTANT**: Make sure you specify `use_frameworks!` in your `Podfile`.
48+
49+
Then, run `pod install`.
50+
51+
### Swift Package Manager
52+
53+
To install MagicBell using [Swift Package Manager](https://www.swift.org/package-manager/), add the dependency as follows to your project:
54+
55+
```swift
56+
dependencies: [
57+
.package(url: "https://github.com/magicbell/magicbell-swift-client", .upToNextMajor(from: "0.1.0"))
58+
]
59+
```
60+
61+
## Authentication
62+
63+
### Access Token Authentication
64+
65+
The MagicBell API uses an Access Token for authentication.
66+
67+
This token must be provided to authenticate your requests to the API.
68+
69+
#### Setting the Access Token
70+
71+
When you initialize the SDK, you can set the access token via the `AuthenticationMiddleware`:
72+
73+
```swift
74+
let authMiddleware = AuthenticationMiddleware(jwtToken: token)
75+
76+
let client = MagicBellClient.Client(
77+
serverURL: try Servers.Server1.url(),
78+
configuration: .init(dateTranscoder: .iso8601WithFractionalSeconds),
79+
transport: URLSessionTransport(),
80+
middlewares: [authMiddleware])
81+
```
82+
83+
If you need to set or update the access token after initializing the SDK you can create a new Client instance.
84+
85+
# Sample Usage
86+
87+
Below is a comprehensive example demonstrating how to authenticate and call a simple endpoint:
88+
89+
```swift
90+
import Foundation
91+
import MagicBellClient
92+
import OpenAPIURLSession
93+
94+
let token = "YOUR_ACCESS_TOKEN"
95+
96+
@main
97+
struct MainApp {
98+
static func main() async throws {
99+
100+
let client = MagicBellClient.Client(
101+
serverURL: try Servers.Server1.url(),
102+
configuration: .init(dateTranscoder: .iso8601WithFractionalSeconds),
103+
transport: URLSessionTransport(),
104+
middlewares: [AuthenticationMiddleware(jwtToken: token)])
105+
106+
let response = try await client.get_mobile_push_apns_tokens(.init())
107+
108+
switch response {
109+
case .ok(let okResponse):
110+
let json = try okResponse.body.json
111+
let tokens = json.data
112+
113+
print("Found \(tokens?.count ?? 0) tokens")
114+
tokens?.forEach({ token in
115+
print("- token: \(token.data.device_token)")
116+
})
117+
118+
case .undocumented(let statusCode, _):
119+
print("Undocumented status code: \(statusCode)")
120+
}
121+
}
122+
}
123+
```
124+
125+
## License
126+
127+
This SDK is licensed under the MIT License.
128+
129+
See the [LICENSE](LICENSE) file for more details.

Sources/MagicBellClientExample/Main.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import OpenAPIURLSession
55
let token =
66
"eyJhbGciOiJSUzI1NiIsImtpZCI6InRyYW5zaWVudCIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FwaS5tYWdpY2JlbGwuY29tIiwiZXhwIjoxNzM2OTg4NjI3LCJpYXQiOjE3MzQzOTY2MjcsImp0aSI6IjAxOTNkMjE4LTQ4ZmMtNzBhOS04NjEyLTFiMDQ5MGQyMzAxMiIsIlJvbGUiOiJVU0VSIiwiVXNlcktleSI6eyJJRCI6ImNhMGFmOTUyLTU3OGItNDUyNC1iZmQ4LTE0OTc0ZTYzMTE2MyIsIkV4dGVybmFsSUQiOiIiLCJFbWFpbCI6InVsbHJpY2hAbWFnaWNiZWxsLmlvIn0sIlByb2plY3RLZXkiOnsiSUQiOjgzNTcsIk5hbWUiOiJBbmRyb2lkIFNESyIsIkFQSUtleSI6ImNhOTUzNGNiMDAyOTk0NjhhOWM4ODU2ZThiNDFjOWQxNjQzMDEyOWQiLCJXb3Jrc3BhY2VJRCI6MTEyMX19.B7weG_TcmZCiOXElOxCrZBQ4g0tnAq5sZmO0znfm96VuyKpZq1kQZ2bOsK7R7sf2WpeeBuAe1fdtrM-qpYVxJWLs5frDf_TULO8SEZywpN1FvpPKyZeDwY3NCM4vfe-Us8l2h5rRWg1vyzl1zglKNqeKKWaUhsLyzBpwhiYtcVQ"
77

8-
let fakeDevieToken =
8+
let fakeDeviceToken =
99
"111051c0ade3a85236dc8aa7f704098230980046e0a06d0ea9af01d749a5def2"
1010

1111
@main
@@ -23,7 +23,7 @@ struct MainApp {
2323
body: .json(
2424
.init(
2525
app_id: "com.example.app",
26-
device_token: fakeDevieToken,
26+
device_token: fakeDeviceToken,
2727
installation_id: .development)))
2828
let postResponse = try await client.save_mobile_push_apns_token(input)
2929

0 commit comments

Comments
 (0)