Skip to content

Commit 87944aa

Browse files
chore(internal): codegen related update (#333)
1 parent 9377a37 commit 87944aa

559 files changed

Lines changed: 298623 additions & 305511 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.

orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,33 @@ import com.withorb.api.services.blocking.TopLevelService
1919
import com.withorb.api.services.blocking.WebhookService
2020

2121
/**
22-
* A client for interacting with the Orb REST API synchronously. You can also switch to asynchronous
23-
* execution via the [async] method.
22+
* A client for interacting with the Orb REST API synchronously. You can also
23+
* switch to asynchronous execution via the [async] method.
2424
*
25-
* This client performs best when you create a single instance and reuse it for all interactions
26-
* with the REST API. This is because each client holds its own connection pool and thread pools.
27-
* Reusing connections and threads reduces latency and saves memory. The client also handles rate
28-
* limiting per client. This means that creating and using multiple instances at the same time will
29-
* not respect rate limits.
25+
* This client performs best when you create a single instance and reuse it for all
26+
* interactions with the REST API. This is because each client holds its own
27+
* connection pool and thread pools. Reusing connections and threads reduces
28+
* latency and saves memory. The client also handles rate limiting per client. This
29+
* means that creating and using multiple instances at the same time will not
30+
* respect rate limits.
3031
*
31-
* The threads and connections that are held will be released automatically if they remain idle. But
32-
* if you are writing an application that needs to aggressively release unused resources, then you
33-
* may call [close].
32+
* The threads and connections that are held will be released automatically if they
33+
* remain idle. But if you are writing an application that needs to aggressively
34+
* release unused resources, then you may call [close].
3435
*/
3536
interface OrbClient {
3637

3738
/**
3839
* Returns a version of this client that uses asynchronous execution.
3940
*
40-
* The returned client shares its resources, like its connection pool and thread pools, with
41-
* this client.
41+
* The returned client shares its resources, like its connection pool and thread
42+
* pools, with this client.
4243
*/
4344
fun async(): OrbClientAsync
4445

4546
/**
46-
* Returns a view of this service that provides access to raw HTTP responses for each method.
47+
* Returns a view of this service that provides access to raw HTTP responses for
48+
* each method.
4749
*/
4850
fun withRawResponse(): WithRawResponse
4951

@@ -80,17 +82,21 @@ interface OrbClient {
8082
/**
8183
* Closes this client, relinquishing any underlying resources.
8284
*
83-
* This is purposefully not inherited from [AutoCloseable] because the client is long-lived and
84-
* usually should not be synchronously closed via try-with-resources.
85+
* This is purposefully not inherited from [AutoCloseable] because the client is
86+
* long-lived and usually should not be synchronously closed via
87+
* try-with-resources.
8588
*
86-
* It's also usually not necessary to call this method at all. the default HTTP client
87-
* automatically releases threads and connections if they remain idle, but if you are writing an
88-
* application that needs to aggressively release unused resources, then you may call this
89-
* method.
89+
* It's also usually not necessary to call this method at all. the default HTTP
90+
* client automatically releases threads and connections if they remain idle, but
91+
* if you are writing an application that needs to aggressively release unused
92+
* resources, then you may call this method.
9093
*/
9194
fun close()
9295

93-
/** A view of [OrbClient] that provides access to raw HTTP responses for each method. */
96+
/**
97+
* A view of [OrbClient] that provides access to raw HTTP responses for each
98+
* method.
99+
*/
94100
interface WithRawResponse {
95101

96102
fun topLevel(): TopLevelService.WithRawResponse

orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,33 @@ import com.withorb.api.services.async.SubscriptionServiceAsync
1818
import com.withorb.api.services.async.TopLevelServiceAsync
1919

2020
/**
21-
* A client for interacting with the Orb REST API asynchronously. You can also switch to synchronous
22-
* execution via the [sync] method.
21+
* A client for interacting with the Orb REST API asynchronously. You can also
22+
* switch to synchronous execution via the [sync] method.
2323
*
24-
* This client performs best when you create a single instance and reuse it for all interactions
25-
* with the REST API. This is because each client holds its own connection pool and thread pools.
26-
* Reusing connections and threads reduces latency and saves memory. The client also handles rate
27-
* limiting per client. This means that creating and using multiple instances at the same time will
28-
* not respect rate limits.
24+
* This client performs best when you create a single instance and reuse it for all
25+
* interactions with the REST API. This is because each client holds its own
26+
* connection pool and thread pools. Reusing connections and threads reduces
27+
* latency and saves memory. The client also handles rate limiting per client. This
28+
* means that creating and using multiple instances at the same time will not
29+
* respect rate limits.
2930
*
30-
* The threads and connections that are held will be released automatically if they remain idle. But
31-
* if you are writing an application that needs to aggressively release unused resources, then you
32-
* may call [close].
31+
* The threads and connections that are held will be released automatically if they
32+
* remain idle. But if you are writing an application that needs to aggressively
33+
* release unused resources, then you may call [close].
3334
*/
3435
interface OrbClientAsync {
3536

3637
/**
3738
* Returns a version of this client that uses synchronous execution.
3839
*
39-
* The returned client shares its resources, like its connection pool and thread pools, with
40-
* this client.
40+
* The returned client shares its resources, like its connection pool and thread
41+
* pools, with this client.
4142
*/
4243
fun sync(): OrbClient
4344

4445
/**
45-
* Returns a view of this service that provides access to raw HTTP responses for each method.
46+
* Returns a view of this service that provides access to raw HTTP responses for
47+
* each method.
4648
*/
4749
fun withRawResponse(): WithRawResponse
4850

@@ -77,17 +79,21 @@ interface OrbClientAsync {
7779
/**
7880
* Closes this client, relinquishing any underlying resources.
7981
*
80-
* This is purposefully not inherited from [AutoCloseable] because the client is long-lived and
81-
* usually should not be synchronously closed via try-with-resources.
82+
* This is purposefully not inherited from [AutoCloseable] because the client is
83+
* long-lived and usually should not be synchronously closed via
84+
* try-with-resources.
8285
*
83-
* It's also usually not necessary to call this method at all. the default HTTP client
84-
* automatically releases threads and connections if they remain idle, but if you are writing an
85-
* application that needs to aggressively release unused resources, then you may call this
86-
* method.
86+
* It's also usually not necessary to call this method at all. the default HTTP
87+
* client automatically releases threads and connections if they remain idle, but
88+
* if you are writing an application that needs to aggressively release unused
89+
* resources, then you may call this method.
8790
*/
8891
fun close()
8992

90-
/** A view of [OrbClientAsync] that provides access to raw HTTP responses for each method. */
93+
/**
94+
* A view of [OrbClientAsync] that provides access to raw HTTP responses for each
95+
* method.
96+
*/
9197
interface WithRawResponse {
9298

9399
fun topLevel(): TopLevelServiceAsync.WithRawResponse

orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt

Lines changed: 42 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -33,74 +33,49 @@ import com.withorb.api.services.async.SubscriptionServiceAsyncImpl
3333
import com.withorb.api.services.async.TopLevelServiceAsync
3434
import com.withorb.api.services.async.TopLevelServiceAsyncImpl
3535

36-
class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAsync {
36+
class OrbClientAsyncImpl(
37+
private val clientOptions: ClientOptions,
38+
39+
) : OrbClientAsync {
3740

3841
private val clientOptionsWithUserAgent =
39-
if (clientOptions.headers.names().contains("User-Agent")) clientOptions
40-
else
41-
clientOptions
42-
.toBuilder()
43-
.putHeader("User-Agent", "${javaClass.simpleName}/Java ${getPackageVersion()}")
44-
.build()
42+
43+
if (clientOptions.headers.names().contains("User-Agent")) clientOptions
44+
45+
else clientOptions.toBuilder().putHeader("User-Agent", "${javaClass.simpleName}/Java ${getPackageVersion()}").build()
4546

4647
// Pass the original clientOptions so that this client sets its own User-Agent.
4748
private val sync: OrbClient by lazy { OrbClientImpl(clientOptions) }
4849

49-
private val withRawResponse: OrbClientAsync.WithRawResponse by lazy {
50-
WithRawResponseImpl(clientOptions)
51-
}
50+
private val withRawResponse: OrbClientAsync.WithRawResponse by lazy { WithRawResponseImpl(clientOptions) }
5251

53-
private val topLevel: TopLevelServiceAsync by lazy {
54-
TopLevelServiceAsyncImpl(clientOptionsWithUserAgent)
55-
}
52+
private val topLevel: TopLevelServiceAsync by lazy { TopLevelServiceAsyncImpl(clientOptionsWithUserAgent) }
5653

57-
private val coupons: CouponServiceAsync by lazy {
58-
CouponServiceAsyncImpl(clientOptionsWithUserAgent)
59-
}
54+
private val coupons: CouponServiceAsync by lazy { CouponServiceAsyncImpl(clientOptionsWithUserAgent) }
6055

61-
private val creditNotes: CreditNoteServiceAsync by lazy {
62-
CreditNoteServiceAsyncImpl(clientOptionsWithUserAgent)
63-
}
56+
private val creditNotes: CreditNoteServiceAsync by lazy { CreditNoteServiceAsyncImpl(clientOptionsWithUserAgent) }
6457

65-
private val customers: CustomerServiceAsync by lazy {
66-
CustomerServiceAsyncImpl(clientOptionsWithUserAgent)
67-
}
58+
private val customers: CustomerServiceAsync by lazy { CustomerServiceAsyncImpl(clientOptionsWithUserAgent) }
6859

69-
private val events: EventServiceAsync by lazy {
70-
EventServiceAsyncImpl(clientOptionsWithUserAgent)
71-
}
60+
private val events: EventServiceAsync by lazy { EventServiceAsyncImpl(clientOptionsWithUserAgent) }
7261

73-
private val invoiceLineItems: InvoiceLineItemServiceAsync by lazy {
74-
InvoiceLineItemServiceAsyncImpl(clientOptionsWithUserAgent)
75-
}
62+
private val invoiceLineItems: InvoiceLineItemServiceAsync by lazy { InvoiceLineItemServiceAsyncImpl(clientOptionsWithUserAgent) }
7663

77-
private val invoices: InvoiceServiceAsync by lazy {
78-
InvoiceServiceAsyncImpl(clientOptionsWithUserAgent)
79-
}
64+
private val invoices: InvoiceServiceAsync by lazy { InvoiceServiceAsyncImpl(clientOptionsWithUserAgent) }
8065

8166
private val items: ItemServiceAsync by lazy { ItemServiceAsyncImpl(clientOptionsWithUserAgent) }
8267

83-
private val metrics: MetricServiceAsync by lazy {
84-
MetricServiceAsyncImpl(clientOptionsWithUserAgent)
85-
}
68+
private val metrics: MetricServiceAsync by lazy { MetricServiceAsyncImpl(clientOptionsWithUserAgent) }
8669

8770
private val plans: PlanServiceAsync by lazy { PlanServiceAsyncImpl(clientOptionsWithUserAgent) }
8871

89-
private val prices: PriceServiceAsync by lazy {
90-
PriceServiceAsyncImpl(clientOptionsWithUserAgent)
91-
}
72+
private val prices: PriceServiceAsync by lazy { PriceServiceAsyncImpl(clientOptionsWithUserAgent) }
9273

93-
private val subscriptions: SubscriptionServiceAsync by lazy {
94-
SubscriptionServiceAsyncImpl(clientOptionsWithUserAgent)
95-
}
74+
private val subscriptions: SubscriptionServiceAsync by lazy { SubscriptionServiceAsyncImpl(clientOptionsWithUserAgent) }
9675

97-
private val alerts: AlertServiceAsync by lazy {
98-
AlertServiceAsyncImpl(clientOptionsWithUserAgent)
99-
}
76+
private val alerts: AlertServiceAsync by lazy { AlertServiceAsyncImpl(clientOptionsWithUserAgent) }
10077

101-
private val dimensionalPriceGroups: DimensionalPriceGroupServiceAsync by lazy {
102-
DimensionalPriceGroupServiceAsyncImpl(clientOptionsWithUserAgent)
103-
}
78+
private val dimensionalPriceGroups: DimensionalPriceGroupServiceAsync by lazy { DimensionalPriceGroupServiceAsyncImpl(clientOptionsWithUserAgent) }
10479

10580
override fun sync(): OrbClient = sync
10681

@@ -132,70 +107,42 @@ class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAs
132107

133108
override fun alerts(): AlertServiceAsync = alerts
134109

135-
override fun dimensionalPriceGroups(): DimensionalPriceGroupServiceAsync =
136-
dimensionalPriceGroups
110+
override fun dimensionalPriceGroups(): DimensionalPriceGroupServiceAsync = dimensionalPriceGroups
137111

138112
override fun close() = clientOptions.httpClient.close()
139113

140-
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
141-
OrbClientAsync.WithRawResponse {
114+
class WithRawResponseImpl internal constructor(
115+
private val clientOptions: ClientOptions,
116+
117+
) : OrbClientAsync.WithRawResponse {
142118

143-
private val topLevel: TopLevelServiceAsync.WithRawResponse by lazy {
144-
TopLevelServiceAsyncImpl.WithRawResponseImpl(clientOptions)
145-
}
119+
private val topLevel: TopLevelServiceAsync.WithRawResponse by lazy { TopLevelServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
146120

147-
private val coupons: CouponServiceAsync.WithRawResponse by lazy {
148-
CouponServiceAsyncImpl.WithRawResponseImpl(clientOptions)
149-
}
121+
private val coupons: CouponServiceAsync.WithRawResponse by lazy { CouponServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
150122

151-
private val creditNotes: CreditNoteServiceAsync.WithRawResponse by lazy {
152-
CreditNoteServiceAsyncImpl.WithRawResponseImpl(clientOptions)
153-
}
123+
private val creditNotes: CreditNoteServiceAsync.WithRawResponse by lazy { CreditNoteServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
154124

155-
private val customers: CustomerServiceAsync.WithRawResponse by lazy {
156-
CustomerServiceAsyncImpl.WithRawResponseImpl(clientOptions)
157-
}
125+
private val customers: CustomerServiceAsync.WithRawResponse by lazy { CustomerServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
158126

159-
private val events: EventServiceAsync.WithRawResponse by lazy {
160-
EventServiceAsyncImpl.WithRawResponseImpl(clientOptions)
161-
}
127+
private val events: EventServiceAsync.WithRawResponse by lazy { EventServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
162128

163-
private val invoiceLineItems: InvoiceLineItemServiceAsync.WithRawResponse by lazy {
164-
InvoiceLineItemServiceAsyncImpl.WithRawResponseImpl(clientOptions)
165-
}
129+
private val invoiceLineItems: InvoiceLineItemServiceAsync.WithRawResponse by lazy { InvoiceLineItemServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
166130

167-
private val invoices: InvoiceServiceAsync.WithRawResponse by lazy {
168-
InvoiceServiceAsyncImpl.WithRawResponseImpl(clientOptions)
169-
}
131+
private val invoices: InvoiceServiceAsync.WithRawResponse by lazy { InvoiceServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
170132

171-
private val items: ItemServiceAsync.WithRawResponse by lazy {
172-
ItemServiceAsyncImpl.WithRawResponseImpl(clientOptions)
173-
}
133+
private val items: ItemServiceAsync.WithRawResponse by lazy { ItemServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
174134

175-
private val metrics: MetricServiceAsync.WithRawResponse by lazy {
176-
MetricServiceAsyncImpl.WithRawResponseImpl(clientOptions)
177-
}
135+
private val metrics: MetricServiceAsync.WithRawResponse by lazy { MetricServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
178136

179-
private val plans: PlanServiceAsync.WithRawResponse by lazy {
180-
PlanServiceAsyncImpl.WithRawResponseImpl(clientOptions)
181-
}
137+
private val plans: PlanServiceAsync.WithRawResponse by lazy { PlanServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
182138

183-
private val prices: PriceServiceAsync.WithRawResponse by lazy {
184-
PriceServiceAsyncImpl.WithRawResponseImpl(clientOptions)
185-
}
139+
private val prices: PriceServiceAsync.WithRawResponse by lazy { PriceServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
186140

187-
private val subscriptions: SubscriptionServiceAsync.WithRawResponse by lazy {
188-
SubscriptionServiceAsyncImpl.WithRawResponseImpl(clientOptions)
189-
}
141+
private val subscriptions: SubscriptionServiceAsync.WithRawResponse by lazy { SubscriptionServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
190142

191-
private val alerts: AlertServiceAsync.WithRawResponse by lazy {
192-
AlertServiceAsyncImpl.WithRawResponseImpl(clientOptions)
193-
}
143+
private val alerts: AlertServiceAsync.WithRawResponse by lazy { AlertServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
194144

195-
private val dimensionalPriceGroups:
196-
DimensionalPriceGroupServiceAsync.WithRawResponse by lazy {
197-
DimensionalPriceGroupServiceAsyncImpl.WithRawResponseImpl(clientOptions)
198-
}
145+
private val dimensionalPriceGroups: DimensionalPriceGroupServiceAsync.WithRawResponse by lazy { DimensionalPriceGroupServiceAsyncImpl.WithRawResponseImpl(clientOptions) }
199146

200147
override fun topLevel(): TopLevelServiceAsync.WithRawResponse = topLevel
201148

@@ -207,8 +154,7 @@ class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAs
207154

208155
override fun events(): EventServiceAsync.WithRawResponse = events
209156

210-
override fun invoiceLineItems(): InvoiceLineItemServiceAsync.WithRawResponse =
211-
invoiceLineItems
157+
override fun invoiceLineItems(): InvoiceLineItemServiceAsync.WithRawResponse = invoiceLineItems
212158

213159
override fun invoices(): InvoiceServiceAsync.WithRawResponse = invoices
214160

@@ -224,7 +170,6 @@ class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAs
224170

225171
override fun alerts(): AlertServiceAsync.WithRawResponse = alerts
226172

227-
override fun dimensionalPriceGroups(): DimensionalPriceGroupServiceAsync.WithRawResponse =
228-
dimensionalPriceGroups
173+
override fun dimensionalPriceGroups(): DimensionalPriceGroupServiceAsync.WithRawResponse = dimensionalPriceGroups
229174
}
230175
}

0 commit comments

Comments
 (0)