@@ -27,9 +27,58 @@ That's it! You can now use the library without any code configuration from:
2727- [ Kotlin projects] ( ./examples/example-project )
2828- [ Jupyter notebooks with the Kotlin kernel] ( ./examples/example-notebooks )
2929
30+ ### Setup snippets
31+
32+ <details >
33+ <summary >Add to a Kotlin script</summary >
34+
35+ ``` kotlin
36+ @file:Repository(" https://jitpack.io" )
37+ @file:DependsOn(" com.github.gabrielfeo:gradle-enterprise-api-kotlin:0.16.0" )
38+ ```
39+
40+ </details >
41+
42+ <details >
43+ <summary >Add to a Kotlin project</summary >
44+
45+ Groovy
46+
47+ ``` groovy
48+ repositories {
49+ maven { url = 'https://jitpack.io' }
50+ }
51+ dependencies {
52+ implementation 'com.github.gabrielfeo:gradle-enterprise-api-kotlin:0.16.0'
53+ }
54+ ```
55+
56+ Kotlin
57+
58+ ``` kotlin
59+ repositories {
60+ maven(url = " https://jitpack.io" )
61+ }
62+ dependencies {
63+ implementation(" com.github.gabrielfeo:gradle-enterprise-api-kotlin:0.16.0" )
64+ }
65+ ```
66+
67+ </details >
68+
69+ <details >
70+ <summary >Add to a Jupyter notebook</summary >
71+
72+ ```
73+ %useLatestDescriptors
74+ %use gradle-enterprise-api-kotlin(version=0.16.0)
75+ ```
76+
77+ </details >
78+
3079## Usage
3180
32- The [ ` GradleEnterpriseApi ` ] [ 9 ] interface represents the Gradle Enterprise REST API. It contains
81+ The [ ` GradleEnterpriseApi ` ] [ 9 ] interface represents the Gradle Enterprise REST API. It contains
3382the 4 APIs exactly as listed in the [ REST API Manual] [ 5 ] :
3483
3584``` kotlin
@@ -63,18 +112,18 @@ finishes, as an [expected behavior of OkHttp][4].
63112### Caching
64113
65114HTTP caching is available, which can speed up queries significantly, but is
66- off by default. Enable by simply setting [ ` GRADLE_ENTERPRISE_API_CACHE_ENABLED ` ] [ 12 ] to ` true ` . See
115+ off by default. Enable by simply setting [ ` GRADLE_ENTERPRISE_API_CACHE_ENABLED ` ] [ 12 ] to ` true ` . See
67116[ ` CacheConfig ` ] [ 13 ] for caveats.
68117
69118### Extensions
70119
71120Explore the library's convenience extensions:
72121[ ` com.gabrielfeo.gradle.enterprise.api.extension ` ] [ 25 ] .
73122
74- What you'll probably use the most is [ ` getGradleAttributesFlow ` ] [ 24 ] , which will call
123+ What you'll probably use the most is [ ` getGradleAttributesFlow ` ] [ 24 ] , which will call
75124` /api/builds ` to get the list of build IDs since a given date and join each with
76- ` /api/builds/{id}/gradle-attributes ` , which contains tags and custom values on each build. It
77- also takes care of paging under-the-hood, returning a [ ` Flow ` ] [ 26 ] of all builds since the given
125+ ` /api/builds/{id}/gradle-attributes ` , which contains tags and custom values on each build. It
126+ also takes care of paging under-the-hood, returning a [ ` Flow ` ] [ 26 ] of all builds since the given
78127date, so you don't have to worry about the REST API's limit of 1000 builds per request:
79128
80129``` kotlin
@@ -88,14 +137,14 @@ builds.collect {
88137
89138[ ![ Javadoc] ( https://img.shields.io/badge/javadoc-latest-orange )] [ 7 ]
90139
91- The javadoc of API interfaces and models, such as [ ` BuildsApi ` ] [ 18 ] and [ ` GradleAttributes ` ] [ 19 ] ,
92- matches the [ REST API Manual] [ 5 ] exactly. Both these classes and Gradle's own manual are generated
140+ The javadoc of API interfaces and models, such as [ ` BuildsApi ` ] [ 18 ] and [ ` GradleAttributes ` ] [ 19 ] ,
141+ matches the [ REST API Manual] [ 5 ] exactly. Both these classes and Gradle's own manual are generated
93142from the same OpenAPI spec.
94143
95144## Optional setup
96145
97- Creating a custom [ ` Config ` ] [ 8 ] allows you to change library settings via code instead of
98- environment variables. It also lets you share resource between the library's ` OkHttpClient ` and
146+ Creating a custom [ ` Config ` ] [ 8 ] allows you to change library settings via code instead of
147+ environment variables. It also lets you share resource between the library's ` OkHttpClient ` and
99148your own. For example:
100149
101150``` kotlin
@@ -112,11 +161,11 @@ See the [`Config`][8] documentation for more.
112161
113162## More info
114163
115- - Currently built for Gradle Enterprise ` 2022.4 ` , but should work fine with previous and
164+ - Currently built for Gradle Enterprise ` 2022.4 ` , but should work fine with previous and
116165 future versions. The library will be updated regularly for new API versions.
117166- Use JDK 8 or 14+ to run, if you want to avoid the [ "illegal reflective access" warning about
118167 Retrofit] [ 3 ]
119- - All classes live in these packages. If you need to make small edits to scripts where there's
168+ - All classes live in these packages. If you need to make small edits to scripts where there's
120169 no auto-complete, wildcard imports can be used:
121170
122171``` kotlin
0 commit comments