Skip to content

Commit 4784160

Browse files
chore(internal): codegen related update (#335)
1 parent bd596c4 commit 4784160

File tree

559 files changed

+305587
-298699
lines changed

Some content is hidden

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

559 files changed

+305587
-298699
lines changed

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

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,31 @@ 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
23-
* switch to asynchronous execution via the [async] method.
22+
* A client for interacting with the Orb REST API synchronously. You can also switch to asynchronous
23+
* execution via the [async] method.
2424
*
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.
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.
3130
*
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].
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].
3534
*/
3635
interface OrbClient {
3736

3837
/**
3938
* Returns a version of this client that uses asynchronous execution.
4039
*
41-
* The returned client shares its resources, like its connection pool and thread
42-
* pools, with this client.
40+
* The returned client shares its resources, like its connection pool and thread pools, with
41+
* this client.
4342
*/
4443
fun async(): OrbClientAsync
4544

4645
/**
47-
* Returns a view of this service that provides access to raw HTTP responses for
48-
* each method.
46+
* Returns a view of this service that provides access to raw HTTP responses for each method.
4947
*/
5048
fun withRawResponse(): WithRawResponse
5149

@@ -82,21 +80,17 @@ interface OrbClient {
8280
/**
8381
* Closes this client, relinquishing any underlying resources.
8482
*
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.
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.
8885
*
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.
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.
9390
*/
9491
fun close()
9592

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

10296
fun topLevel(): TopLevelService.WithRawResponse

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

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,31 @@ 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
22-
* switch to synchronous execution via the [sync] method.
21+
* A client for interacting with the Orb REST API asynchronously. You can also switch to synchronous
22+
* execution via the [sync] method.
2323
*
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.
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.
3029
*
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].
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].
3433
*/
3534
interface OrbClientAsync {
3635

3736
/**
3837
* Returns a version of this client that uses synchronous execution.
3938
*
40-
* The returned client shares its resources, like its connection pool and thread
41-
* pools, with this client.
39+
* The returned client shares its resources, like its connection pool and thread pools, with
40+
* this client.
4241
*/
4342
fun sync(): OrbClient
4443

4544
/**
46-
* Returns a view of this service that provides access to raw HTTP responses for
47-
* each method.
45+
* Returns a view of this service that provides access to raw HTTP responses for each method.
4846
*/
4947
fun withRawResponse(): WithRawResponse
5048

@@ -79,21 +77,17 @@ interface OrbClientAsync {
7977
/**
8078
* Closes this client, relinquishing any underlying resources.
8179
*
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.
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.
8582
*
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.
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.
9087
*/
9188
fun close()
9289

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

9993
fun topLevel(): TopLevelServiceAsync.WithRawResponse

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

Lines changed: 97 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -33,49 +33,74 @@ 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(
37-
private val clientOptions: ClientOptions,
38-
39-
) : OrbClientAsync {
36+
class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAsync {
4037

4138
private val clientOptionsWithUserAgent =
42-
43-
if (clientOptions.headers.names().contains("User-Agent")) clientOptions
44-
45-
else clientOptions.toBuilder().putHeader("User-Agent", "${javaClass.simpleName}/Java ${getPackageVersion()}").build()
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()
4645

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

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

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

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

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

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

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

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

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

6681
private val items: ItemServiceAsync by lazy { ItemServiceAsyncImpl(clientOptionsWithUserAgent) }
6782

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

7087
private val plans: PlanServiceAsync by lazy { PlanServiceAsyncImpl(clientOptionsWithUserAgent) }
7188

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

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

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

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

80105
override fun sync(): OrbClient = sync
81106

@@ -107,42 +132,70 @@ class OrbClientAsyncImpl(
107132

108133
override fun alerts(): AlertServiceAsync = alerts
109134

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

112138
override fun close() = clientOptions.httpClient.close()
113139

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

147200
override fun topLevel(): TopLevelServiceAsync.WithRawResponse = topLevel
148201

@@ -154,7 +207,8 @@ class OrbClientAsyncImpl(
154207

155208
override fun events(): EventServiceAsync.WithRawResponse = events
156209

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

159213
override fun invoices(): InvoiceServiceAsync.WithRawResponse = invoices
160214

@@ -170,6 +224,7 @@ class OrbClientAsyncImpl(
170224

171225
override fun alerts(): AlertServiceAsync.WithRawResponse = alerts
172226

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

0 commit comments

Comments
 (0)