Skip to content

Commit 9418324

Browse files
committed
feat: initial stlc build
Stainless-Generated-From: 34d1ce79996b661b73ebd887b8844cdc97b92faf
1 parent 2c6dc90 commit 9418324

58 files changed

Lines changed: 370 additions & 144 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
lint:
1919
timeout-minutes: 15
2020
name: lint
21-
runs-on: ${{ github.repository == 'stainless-sdks/imagekit-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
21+
runs-on: ubuntu-latest
2222
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
2323

2424
steps:
@@ -45,7 +45,7 @@ jobs:
4545
permissions:
4646
contents: read
4747
id-token: write
48-
runs-on: ${{ github.repository == 'stainless-sdks/imagekit-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
48+
runs-on: ubuntu-latest
4949
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
5050

5151
steps:
@@ -66,44 +66,6 @@ jobs:
6666
- name: Build SDK
6767
run: ./scripts/build
6868

69-
- name: Get GitHub OIDC Token
70-
if: |-
71-
github.repository == 'stainless-sdks/imagekit-java' &&
72-
!startsWith(github.ref, 'refs/heads/stl/')
73-
id: github-oidc
74-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
75-
with:
76-
script: core.setOutput('github_token', await core.getIDToken());
7769

78-
- name: Build and upload Maven artifacts
79-
if: |-
80-
github.repository == 'stainless-sdks/imagekit-java' &&
81-
!startsWith(github.ref, 'refs/heads/stl/')
82-
env:
83-
URL: https://pkg.stainless.com/s
84-
AUTH: ${{ steps.github-oidc.outputs.github_token }}
85-
SHA: ${{ github.sha }}
86-
PROJECT: imagekit-java
87-
run: ./scripts/upload-artifacts
88-
test:
89-
timeout-minutes: 15
90-
name: test
91-
runs-on: ${{ github.repository == 'stainless-sdks/imagekit-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
92-
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
93-
steps:
94-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
95-
96-
- name: Set up Java
97-
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
98-
with:
99-
distribution: temurin
100-
java-version: |
101-
8
102-
21
103-
cache: gradle
10470

105-
- name: Set up Gradle
106-
uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0
10771

108-
- name: Run tests
109-
run: ./scripts/test

.github/workflows/publish-sonatype.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
# This workflow is triggered when a GitHub release is created.
2-
# It can also be run manually to re-publish to Sonatype in case it failed for some reason.
3-
# You can run this workflow by navigating to https://www.github.com/imagekit-developer/imagekit-java/actions/workflows/publish-sonatype.yml
1+
# workflow for re-running publishing to Sonatype in case it fails for some reason
2+
# you can run this workflow by navigating to https://www.github.com/imagekit-developer/imagekit-java/actions/workflows/publish-sonatype.yml
43
name: Publish Sonatype
54
on:
65
workflow_dispatch:
76

8-
release:
9-
types: [published]
10-
117
jobs:
128
publish:
139
name: publish

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
run: |
1919
bash ./bin/check-release-environment
2020
env:
21+
RELEASE_PLEASE_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
2122
SONATYPE_USERNAME: ${{ secrets.IMAGE_KIT_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }}
2223
SONATYPE_PASSWORD: ${{ secrets.IMAGE_KIT_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }}
2324
GPG_SIGNING_KEY: ${{ secrets.IMAGE_KIT_SONATYPE_GPG_SIGNING_KEY || secrets.GPG_SIGNING_KEY }}

.stats.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
11
configured_endpoints: 47
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc/imagekit-01267e4c07ec30011b8445babed88fbd2133b65198f42d0310b7ab39c74751d4.yml
3-
openapi_spec_hash: 7c103e2dff0edcbeea82057e62f58d4d
4-
config_hash: 7ef70b333059ca21bef0f0a6d4cbb282

bin/check-release-environment

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
errors=()
44

5+
if [ -z "${RELEASE_PLEASE_TOKEN}" ]; then
6+
errors+=("The RELEASE_PLEASE_TOKEN secret has not been set. Create a fine-grained GitHub PAT and add it as a repository secret.")
7+
fi
8+
59
if [ -z "${SONATYPE_USERNAME}" ]; then
610
errors+=("The SONATYPE_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets")
711
fi

image-kit-java-core/src/main/kotlin/io/imagekit/core/Check.kt

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,45 +24,39 @@ internal fun <T : Any> checkKnown(name: String, value: MultipartField<T>): T =
2424
}
2525

2626
@JvmSynthetic
27-
internal fun checkLength(name: String, value: String, length: Int): String =
28-
value.also {
29-
check(it.length == length) { "`$name` must have length $length, but was ${it.length}" }
30-
}
27+
internal fun checkLength(name: String, value: String, length: Int): String = value.also {
28+
check(it.length == length) { "`$name` must have length $length, but was ${it.length}" }
29+
}
3130

3231
@JvmSynthetic
33-
internal fun checkMinLength(name: String, value: String, minLength: Int): String =
34-
value.also {
35-
check(it.length >= minLength) {
36-
if (minLength == 1) "`$name` must be non-empty, but was empty"
37-
else "`$name` must have at least length $minLength, but was ${it.length}"
38-
}
32+
internal fun checkMinLength(name: String, value: String, minLength: Int): String = value.also {
33+
check(it.length >= minLength) {
34+
if (minLength == 1) "`$name` must be non-empty, but was empty"
35+
else "`$name` must have at least length $minLength, but was ${it.length}"
3936
}
37+
}
4038

4139
@JvmSynthetic
42-
internal fun checkMaxLength(name: String, value: String, maxLength: Int): String =
43-
value.also {
44-
check(it.length <= maxLength) {
45-
"`$name` must have at most length $maxLength, but was ${it.length}"
46-
}
40+
internal fun checkMaxLength(name: String, value: String, maxLength: Int): String = value.also {
41+
check(it.length <= maxLength) {
42+
"`$name` must have at most length $maxLength, but was ${it.length}"
4743
}
44+
}
4845

4946
@JvmSynthetic
5047
internal fun checkJacksonVersionCompatibility() {
51-
val incompatibleJacksonVersions =
52-
RUNTIME_JACKSON_VERSIONS.mapNotNull {
53-
val badVersionReason = BAD_JACKSON_VERSIONS[it.toString()]
54-
when {
55-
it.majorVersion != MINIMUM_JACKSON_VERSION.majorVersion ->
56-
it to "incompatible major version"
57-
it.minorVersion < MINIMUM_JACKSON_VERSION.minorVersion ->
58-
it to "minor version too low"
59-
it.minorVersion == MINIMUM_JACKSON_VERSION.minorVersion &&
60-
it.patchLevel < MINIMUM_JACKSON_VERSION.patchLevel ->
61-
it to "patch version too low"
62-
badVersionReason != null -> it to badVersionReason
63-
else -> null
64-
}
48+
val incompatibleJacksonVersions = RUNTIME_JACKSON_VERSIONS.mapNotNull {
49+
val badVersionReason = BAD_JACKSON_VERSIONS[it.toString()]
50+
when {
51+
it.majorVersion != MINIMUM_JACKSON_VERSION.majorVersion ->
52+
it to "incompatible major version"
53+
it.minorVersion < MINIMUM_JACKSON_VERSION.minorVersion -> it to "minor version too low"
54+
it.minorVersion == MINIMUM_JACKSON_VERSION.minorVersion &&
55+
it.patchLevel < MINIMUM_JACKSON_VERSION.patchLevel -> it to "patch version too low"
56+
badVersionReason != null -> it to badVersionReason
57+
else -> null
6558
}
59+
}
6660
check(incompatibleJacksonVersions.isEmpty()) {
6761
"""
6862
This SDK requires a minimum Jackson version of $MINIMUM_JACKSON_VERSION, but the following incompatible Jackson versions were detected at runtime:

image-kit-java-core/src/main/kotlin/io/imagekit/models/BaseOverlay.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,11 @@ private constructor(
315315
* An enum containing [LayerMode]'s known values, as well as an [_UNKNOWN] member.
316316
*
317317
* An instance of [LayerMode] can contain an unknown value in a couple of cases:
318+
*
318319
* - It was deserialized from data that doesn't match any known member. For example, if the
319320
* SDK is on an older version than the API, then the API may respond with new members that
320321
* the SDK is unaware of.
322+
*
321323
* - It was constructed with an arbitrary value using the [of] method.
322324
*/
323325
enum class Value {

image-kit-java-core/src/main/kotlin/io/imagekit/models/CustomMetadata.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ private constructor(
9999
* Used for best match union deserialization.
100100
*/
101101
@JvmSynthetic
102-
internal fun validity(): Int =
103-
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
102+
internal fun validity(): Int = additionalProperties.count { (_, value) ->
103+
!value.isNull() && !value.isMissing()
104+
}
104105

105106
override fun equals(other: Any?): Boolean {
106107
if (this === other) {

image-kit-java-core/src/main/kotlin/io/imagekit/models/EmbeddedMetadata.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ private constructor(
101101
* Used for best match union deserialization.
102102
*/
103103
@JvmSynthetic
104-
internal fun validity(): Int =
105-
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
104+
internal fun validity(): Int = additionalProperties.count { (_, value) ->
105+
!value.isNull() && !value.isMissing()
106+
}
106107

107108
override fun equals(other: Any?): Boolean {
108109
if (this === other) {

image-kit-java-core/src/main/kotlin/io/imagekit/models/ExtensionConfig.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,9 +1063,11 @@ private constructor(
10631063
* An enum containing [Name]'s known values, as well as an [_UNKNOWN] member.
10641064
*
10651065
* An instance of [Name] can contain an unknown value in a couple of cases:
1066+
*
10661067
* - It was deserialized from data that doesn't match any known member. For example, if
10671068
* the SDK is on an older version than the API, then the API may respond with new
10681069
* members that the SDK is unaware of.
1070+
*
10691071
* - It was constructed with an arbitrary value using the [of] method.
10701072
*/
10711073
enum class Value {
@@ -3739,7 +3741,9 @@ private constructor(
37393741
override fun visitBool(bool: Boolean) = 1
37403742

37413743
override fun visitMixed(mixed: List<MetadataValueItem>) =
3742-
mixed.sumOf { it.validity().toInt() }
3744+
mixed.sumOf {
3745+
it.validity().toInt()
3746+
}
37433747

37443748
override fun unknown(json: JsonValue?) = 0
37453749
}
@@ -5076,7 +5080,9 @@ private constructor(
50765080
override fun visitBool(bool: Boolean) = 1
50775081

50785082
override fun visitMixed(mixed: List<MetadataValueItem>) =
5079-
mixed.sumOf { it.validity().toInt() }
5083+
mixed.sumOf {
5084+
it.validity().toInt()
5085+
}
50805086

50815087
override fun unknown(json: JsonValue?) = 0
50825088
}
@@ -6411,7 +6417,9 @@ private constructor(
64116417
override fun visitBool(bool: Boolean) = 1
64126418

64136419
override fun visitMixed(mixed: List<MetadataValueItem>) =
6414-
mixed.sumOf { it.validity().toInt() }
6420+
mixed.sumOf {
6421+
it.validity().toInt()
6422+
}
64156423

64166424
override fun unknown(json: JsonValue?) = 0
64176425
}

0 commit comments

Comments
 (0)