Skip to content

feat: support null-friendly parameters #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 18 additions & 10 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
lockVersion: 2.0.0
id: 38254260-287a-40b6-9ac5-c2fcb654c9cc
management:
docChecksum: 4ebd66f6415f48e48d4ff856025bbc34
docVersion: 10.18.1
speakeasyVersion: 1.580.0
generationVersion: 2.654.2
releaseVersion: 0.17.0
configChecksum: 42a88858ca56be2168e476dbf46b7468
docChecksum: 4b13b0469dc398831faaf2ccad969e02
docVersion: 10.18.2
speakeasyVersion: 1.580.1
generationVersion: 2.656.3
releaseVersion: 0.18.0
configChecksum: ad5c4a18e09ee741fa2b3fe2c78e40a9
repoURL: https://github.com/apideck-libraries/sdk-java.git
published: true
features:
java:
acceptHeaders: 2.81.2
additionalDependencies: 0.1.0
constsAndDefaults: 0.1.1
core: 3.43.0
core: 3.44.0
deprecations: 2.81.1
downloadStreams: 0.1.1
errors: 0.5.0
Expand Down Expand Up @@ -120,8 +120,11 @@ generatedFiles:
- docs/models/components/Branch.md
- docs/models/components/By.md
- docs/models/components/Categories.md
- docs/models/components/CategoriesFilter.md
- docs/models/components/CategoriesFilterType.md
- docs/models/components/Category.md
- docs/models/components/CategoryStatus.md
- docs/models/components/CategoryType.md
- docs/models/components/Classification.md
- docs/models/components/Collection.md
- docs/models/components/CollectionTag.md
Expand Down Expand Up @@ -1686,8 +1689,11 @@ generatedFiles:
- src/main/java/com/apideck/unify/models/components/Branch.java
- src/main/java/com/apideck/unify/models/components/By.java
- src/main/java/com/apideck/unify/models/components/Categories.java
- src/main/java/com/apideck/unify/models/components/CategoriesFilter.java
- src/main/java/com/apideck/unify/models/components/CategoriesFilterType.java
- src/main/java/com/apideck/unify/models/components/Category.java
- src/main/java/com/apideck/unify/models/components/CategoryStatus.java
- src/main/java/com/apideck/unify/models/components/CategoryType.java
- src/main/java/com/apideck/unify/models/components/Classification.java
- src/main/java/com/apideck/unify/models/components/Collection.java
- src/main/java/com/apideck/unify/models/components/CollectionTag.java
Expand Down Expand Up @@ -6094,7 +6100,7 @@ examples:
parameters:
query:
pass_through: {"search": "San Francisco"}
filter: {"start_date": "2021-01-01", "end_date": "2021-12-31", "period_count": 3, "period_type": "month"}
filter: {"start_date": "2021-01-01", "end_date": "2021-12-31", "period_count": 3, "period_type": "month", "location_id": "123"}
raw: false
header:
x-apideck-consumer-id: "test-consumer"
Expand Down Expand Up @@ -6146,7 +6152,7 @@ examples:
parameters:
query:
raw: false
filter: {"customer_id": "123abc", "start_date": "2021-01-01", "end_date": "2021-12-31"}
filter: {"customer_id": "123abc", "start_date": "2021-01-01", "end_date": "2021-12-31", "location_id": "123"}
pass_through: {"search": "San Francisco"}
fields: "id,updated_at"
header:
Expand Down Expand Up @@ -18555,6 +18561,7 @@ examples:
raw: false
limit: 20
fields: "id,updated_at"
filter: {"type": "expense"}
header:
x-apideck-consumer-id: "test-consumer"
x-apideck-app-id: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
Expand Down Expand Up @@ -18582,13 +18589,14 @@ examples:
query:
raw: false
fields: "id,updated_at"
filter: {"type": "expense"}
header:
x-apideck-consumer-id: "test-consumer"
x-apideck-app-id: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
x-apideck-service-id: "salesforce"
responses:
"200":
application/json: {"status_code": 200, "status": "OK", "service": "xero", "resource": "categories", "operation": "one", "data": {"id": "12345", "name": "Insurance", "status": "active", "row_version": "1-12345", "updated_by": "12345", "created_by": "12345", "updated_at": "2020-09-30T07:43:32.000Z", "created_at": "2020-09-30T07:43:32.000Z", "pass_through": [{"service_id": "<id>", "extend_paths": [{"path": "$.nested.property", "value": {"TaxClassificationRef": {"value": "EUC-99990201-V1-00020000"}}}]}]}}
application/json: {"status_code": 200, "status": "OK", "service": "xero", "resource": "categories", "operation": "one", "data": {"id": "12345", "name": "Insurance", "type": "expense", "status": "active", "row_version": "1-12345", "updated_by": "12345", "created_by": "12345", "updated_at": "2020-09-30T07:43:32.000Z", "created_at": "2020-09-30T07:43:32.000Z", "pass_through": [{"service_id": "<id>", "extend_paths": [{"path": "$.nested.property", "value": {"TaxClassificationRef": {"value": "EUC-99990201-V1-00020000"}}}]}]}}
"400":
application/json: {"status_code": 400, "error": "Bad Request", "type_name": "RequestValidationError", "message": "Invalid Params", "detail": "Missing property foobar", "ref": "https://developers.apideck.com/errors#requestvalidationerror"}
"401":
Expand Down
4 changes: 2 additions & 2 deletions .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ generation:
generateNewTests: false
skipResponseBodyAssertions: false
java:
version: 0.17.0
version: 0.18.0
additionalDependencies: []
additionalPlugins: []
artifactID: unify
Expand Down Expand Up @@ -49,7 +49,7 @@ java:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
maxMethodParams: 4
nullFriendlyParameters: false
nullFriendlyParameters: true
outputModelSuffix: output
projectName: Apideck
templateVersion: v2
4 changes: 1 addition & 3 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
speakeasyVersion: 1.580.0
speakeasyVersion: 1.580.1
sources:
Apideck-OAS:
sourceNamespace: apideck-oas
Expand All @@ -14,8 +14,6 @@ targets:
sourceNamespace: apideck-oas
sourceRevisionDigest: sha256:4e5ea980efa2d844788144660b93b76802a197d99468a03154daa316091eefdd
sourceBlobDigest: sha256:275db019e800ca2644dd66201d8dc33648dcf5a2bd807a3b52c6c78675f8be2e
codeSamplesNamespace: apideck-oas-java-code-samples
codeSamplesRevisionDigest: sha256:b1525a6d983818787567be56dcb71c183ae6d93dc0d4717ac12ccdaa2ac4456d
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
63 changes: 34 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ For more information about the API: [Apideck Developer Docs](https://developers.
* [Error Handling](#error-handling)
* [Server Selection](#server-selection)
* [Authentication](#authentication)
* [Debugging](#debugging)
* [Development](#development)
* [Maturity](#maturity)
* [Contributions](#contributions)
Expand All @@ -47,15 +48,15 @@ The samples below show how a published SDK artifact is used:

Gradle:
```groovy
implementation 'com.apideck:unify:0.17.0'
implementation 'com.apideck:unify:0.18.0'
```

Maven:
```xml
<dependency>
<groupId>com.apideck</groupId>
<artifactId>unify</artifactId>
<version>0.17.0</version>
<version>0.18.0</version>
</dependency>
```

Expand All @@ -72,33 +73,6 @@ On Windows:
```bash
gradlew.bat publishToMavenLocal -Pskip.signing
```

### Logging
A logging framework/facade has not yet been adopted but is under consideration.

For request and response logging (especially json bodies), call `enableHTTPDebugLogging(boolean)` on the SDK builder like so:
```java
SDK.builder()
.enableHTTPDebugLogging(true)
.build();
```
Example output:
```
Sending request: http://localhost:35123/bearer#global GET
Request headers: {Accept=[application/json], Authorization=[******], Client-Level-Header=[added by client], Idempotency-Key=[some-key], x-speakeasy-user-agent=[speakeasy-sdk/java 0.0.1 internal 0.1.0 org.openapis.openapi]}
Received response: (GET http://localhost:35123/bearer#global) 200
Response headers: {access-control-allow-credentials=[true], access-control-allow-origin=[*], connection=[keep-alive], content-length=[50], content-type=[application/json], date=[Wed, 09 Apr 2025 01:43:29 GMT], server=[gunicorn/19.9.0]}
Response body:
{
"authenticated": true,
"token": "global"
}
```
__WARNING__: This should only used for temporary debugging purposes. Leaving this option on in a production system could expose credentials/secrets in logs. <i>Authorization</i> headers are redacted by default and there is the ability to specify redacted header names via `SpeakeasyHTTPClient.setRedactedHeaders`.

__NOTE__: This is a convenience method that calls `HTTPClient.enableDebugLogging()`. The `SpeakeasyHTTPClient` honors this setting. If you are using a custom HTTP client, it is up to the custom client to honor this setting.

Another option is to set the System property `-Djdk.httpclient.HttpClient.log=all`. However, this second option does not log bodies.
<!-- End SDK Installation [installation] -->

<!-- Start SDK Example Usage [usage] -->
Expand Down Expand Up @@ -1140,6 +1114,37 @@ public class Application {
```
<!-- End Authentication [security] -->

<!-- Start Debugging [debug] -->
## Debugging

### Debug
You can setup your SDK to emit debug logs for SDK requests and responses.

For request and response logging (especially json bodies), call `enableHTTPDebugLogging(boolean)` on the SDK builder like so:
```java
SDK.builder()
.enableHTTPDebugLogging(true)
.build();
```
Example output:
```
Sending request: http://localhost:35123/bearer#global GET
Request headers: {Accept=[application/json], Authorization=[******], Client-Level-Header=[added by client], Idempotency-Key=[some-key], x-speakeasy-user-agent=[speakeasy-sdk/java 0.0.1 internal 0.1.0 org.openapis.openapi]}
Received response: (GET http://localhost:35123/bearer#global) 200
Response headers: {access-control-allow-credentials=[true], access-control-allow-origin=[*], connection=[keep-alive], content-length=[50], content-type=[application/json], date=[Wed, 09 Apr 2025 01:43:29 GMT], server=[gunicorn/19.9.0]}
Response body:
{
"authenticated": true,
"token": "global"
}
```
__WARNING__: This should only used for temporary debugging purposes. Leaving this option on in a production system could expose credentials/secrets in logs. <i>Authorization</i> headers are redacted by default and there is the ability to specify redacted header names via `SpeakeasyHTTPClient.setRedactedHeaders`.

__NOTE__: This is a convenience method that calls `HTTPClient.enableDebugLogging()`. The `SpeakeasyHTTPClient` honors this setting. If you are using a custom HTTP client, it is up to the custom client to honor this setting.

Another option is to set the System property `-Djdk.httpclient.HttpClient.log=all`. However, this second option does not log bodies.
<!-- End Debugging [debug] -->

<!-- Placeholder for Future Speakeasy SDK Sections -->

# Development
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ publishing {
// https://github.com/gradle/gradle/issues/18619
groupId = "com.apideck"
artifactId = "unify"
version = "0.17.0"
version = "0.18.0"

from components.java

Expand Down Expand Up @@ -162,6 +162,7 @@ dependencies {
api('org.openapitools:jackson-databind-nullable:0.2.6') {exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'}
implementation 'commons-io:commons-io:2.18.0'
implementation 'com.jayway.jsonpath:json-path:2.9.0'
implementation 'jakarta.annotation:jakarta.annotation-api:3.0.0'
}

apply from: 'build-extras.gradle'
3 changes: 2 additions & 1 deletion docs/models/components/BalanceSheetFilter.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
| ~~`startDate`~~ | *Optional\<String>* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.<br/><br/>The start date of the period to include in the resource. | 2021-01-01 |
| `endDate` | *Optional\<String>* | :heavy_minus_sign: | The end date of the period to include in the resource. | 2021-12-31 |
| `periodCount` | *Optional\<Long>* | :heavy_minus_sign: | The number of periods to include in the resource. | 3 |
| `periodType` | [Optional\<PeriodType>](../../models/components/PeriodType.md) | :heavy_minus_sign: | The type of period to include in the resource: month, quarter, year. | month |
| `periodType` | [Optional\<PeriodType>](../../models/components/PeriodType.md) | :heavy_minus_sign: | The type of period to include in the resource: month, quarter, year. | month |
| `locationId` | *Optional\<String>* | :heavy_minus_sign: | The ID of the location to include in the resource. | 123 |
8 changes: 8 additions & 0 deletions docs/models/components/CategoriesFilter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# CategoriesFilter


## Fields

| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `type` | [Optional\<CategoriesFilterType>](../../models/components/CategoriesFilterType.md) | :heavy_minus_sign: | The type of the category. | expense |
12 changes: 12 additions & 0 deletions docs/models/components/CategoriesFilterType.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# CategoriesFilterType

The type of the category.


## Values

| Name | Value |
| ---------- | ---------- |
| `SUPPLIER` | supplier |
| `EXPENSE` | expense |
| `REVENUE` | revenue |
Loading