Skip to content

Commit f8de7b1

Browse files
committed
Initial commit
0 parents  commit f8de7b1

File tree

118 files changed

+915
-0
lines changed

Some content is hidden

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

118 files changed

+915
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Xcode
2+
#
3+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4+
5+
## User settings
6+
xcuserdata/
7+
8+
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
9+
*.xcscmblueprint
10+
*.xccheckout
11+
12+
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
13+
build/
14+
DerivedData/
15+
*.moved-aside
16+
*.pbxuser
17+
!default.pbxuser
18+
*.mode1v3
19+
!default.mode1v3
20+
*.mode2v3
21+
!default.mode2v3
22+
*.perspectivev3
23+
!default.perspectivev3
24+
25+
## Obj-C/Swift specific
26+
*.hmap
27+
28+
## App packaging
29+
*.ipa
30+
*.dSYM.zip
31+
*.dSYM
32+
33+
## Playgrounds
34+
timeline.xctimeline
35+
playground.xcworkspace
36+
37+
# Swift Package Manager
38+
#
39+
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
40+
# Packages/
41+
# Package.pins
42+
# Package.resolved
43+
# *.xcodeproj
44+
#
45+
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
46+
# hence it is not needed unless you have added a package configuration file to your project
47+
# .swiftpm
48+
.DS_Store
49+
/.build
50+
/Packages
51+
xcuserdata/
52+
DerivedData/
53+
.swiftpm/configuration/registries.json
54+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
55+
.netrc
56+
57+
# CocoaPods
58+
#
59+
# We recommend against adding the Pods directory to your .gitignore. However
60+
# you should judge for yourself, the pros and cons are mentioned at:
61+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
62+
#
63+
# Pods/
64+
#
65+
# Add this line if you want to avoid checking in source code from the Xcode workspace
66+
# *.xcworkspace
67+
68+
# Carthage
69+
#
70+
# Add this line if you want to avoid checking in source code from Carthage dependencies.
71+
# Carthage/Checkouts
72+
73+
Carthage/Build/
74+
75+
# Accio dependency management
76+
Dependencies/
77+
.accio/
78+
79+
# fastlane
80+
#
81+
# It is recommended to not store the screenshots in the git repo.
82+
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
83+
# For more information about the recommended setup visit:
84+
# https://docs.fastlane.tools/best-practices/source-control/#source-control
85+
86+
fastlane/report.xml
87+
fastlane/Preview.html
88+
fastlane/screenshots/**/*.png
89+
fastlane/test_output
90+
91+
# Code Injection
92+
#
93+
# After new code Injection tools there's a generated folder /iOSInjectionProject
94+
# https://github.com/johnno1962/injectionforxcode
95+
96+
iOSInjectionProject/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "Submodule/github/rest-api-description"]
2+
path = Submodule/github/rest-api-description
3+
url = git@github.com:github/rest-api-description.git

.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Wei18
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Package.resolved

Lines changed: 95 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// swift-tools-version: 5.9
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
/// The generator supports filtering the OpenAPI document prior to generation,
7+
/// which can be useful when generating client code for a subset of a large API,
8+
/// or splitting an implementation of a server across multiple modules.
9+
enum GitHubRestAPIOpenAPITag: String, CaseIterable {
10+
case activity
11+
case apps
12+
case billing
13+
case checks
14+
case codeScanning = "code-scanning"
15+
case codesOfConduct = "codes-of-conduct"
16+
case emojis
17+
case dependabot
18+
case dependencyGraph = "dependency-graph"
19+
case gists
20+
case git
21+
case gitignore
22+
case issues
23+
case licenses
24+
case markdown
25+
case mergeQueue = "merge-queue"
26+
case meta
27+
case migrations
28+
case oidc
29+
case orgs
30+
case packages
31+
case projects
32+
case pulls
33+
case rateLimit = "rate-limit"
34+
case reactions
35+
case repos
36+
case search
37+
case secretScanning = "secret-scanning"
38+
case teams
39+
case users
40+
case codespaces
41+
case copilot
42+
case securityAdvisories = "security-advisories"
43+
case interactions
44+
case classroom
45+
case desktop
46+
47+
var target: PackageDescription.Target {
48+
.target(
49+
name: rawValue,
50+
dependencies: [
51+
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
52+
.product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"),
53+
],
54+
plugins: [
55+
.plugin(name: "OpenAPIGenerator", package: "swift-openapi-generator"),
56+
]
57+
)
58+
}
59+
60+
var library: PackageDescription.Product {
61+
.library(
62+
name: "GitHubRestAPI-\(rawValue)",
63+
targets: [rawValue]
64+
)
65+
}
66+
}
67+
68+
let package = Package(
69+
name: "GitHubRestAPISwiftOpenAPI",
70+
platforms: [.macOS(.v10_15)],
71+
products: GitHubRestAPIOpenAPITag.allCases.map(\.library),
72+
dependencies: [
73+
.package(url: "https://github.com/apple/swift-openapi-generator", from: "1.0.0"),
74+
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.0.0"),
75+
.package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.0"),
76+
],
77+
targets: GitHubRestAPIOpenAPITag.allCases.map(\.target) + [
78+
.testTarget(name: "UserTests")
79+
]
80+
)

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# GitHub's REST API Swift Language Code Generator
2+
3+
This Swift code generator is built upon the [Swift OpenAPI Generator](https://github.com/apple/swift-openapi-generator) and leverages the OpenAPI description for GitHub's REST API. The goal is to automate the creation of Swift language bindings, providing developers with a seamless way to interact with GitHub's REST API.
4+
5+
## Overview
6+
7+
[OpenAPI](https://www.openapis.org/) serves as a standardized way to document HTTP services. It allows developers to automate workflows, such as generating code for making HTTP requests or implementing API servers. The Swift OpenAPI Generator is a Swift package plugin designed to generate code at build-time, ensuring it remains synchronized with the OpenAPI document.
8+
9+
Use [Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) to clone [github/rest-api-description](https://github.com/github/ and then split openapi tags into multiple modules (Swift Package Products).
10+
11+
# Motivation
12+
13+
Wanna use Swift as the development language to create some convenient and user-friendly GitHub Actions.
14+
15+
# Contributions
16+
17+
Contributions are welcome! If you encounter issues or have suggestions for improvements, feel free to open an issue or submit a pull request.

Sources/activity/File.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by zwc on 2023/12/31.
6+
//
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
generate:
2+
- types
3+
- client
4+
5+
filter:
6+
tags:
7+
- activity
8+
9+
accessModifier: public

0 commit comments

Comments
 (0)